Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Newton character movement

Author
Message
Numisi
13
Years of Service
User Offline
Joined: 27th Jul 2012
Location:
Posted: 29th Aug 2013 00:24
I have a problem with newton physics, I understand how to move the newtonian object for the player, but I don't understand how to make it stand up, because it continuously falls on its side. I tried to set high resistance to rotation on the 3 axis, but it finally falls, I tried omega commands, but setting every cycle angular speed to 0 means it bugs becoming blocked in the ground, so... How the heck do you impede side fall of the player?? Please help me, it's the ony obstacle on my way!
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 29th Aug 2013 00:57
So wait, you have a ragdoll set up for your main character, but he keeps falling over?

Numisi
13
Years of Service
User Offline
Joined: 27th Jul 2012
Location:
Posted: 29th Aug 2013 14:18
Not a ragdoll, I used a simple capsule collision, rotated to be vertical. I haven't tried ragdolls for animated pcs or npcs, I thought it was impractical, if even possible. If you have a nice idea on how to use that instead of a capsule I'm open to every suggestion.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 29th Aug 2013 14:47
There's a command which can pin an object upright. I can't remember what it's called as I don't use Newton but I know it has a Y in it. Not very helpful I know, but the fps demo contains the code you need to setup a character controller.

thenerd
17
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 29th Aug 2013 18:00
Check out:

NDB_NewtonConstraintCreateUpVector
NDB_NewtonUpVectorGetPin
NDB_NewtonUpVectorSetPin


These commands allow you to create a constraint that will keep an object aligned a vector. Read the help files for more details. This is what the fps controller demo uses.

Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 30th Aug 2013 00:33
Up vector, that's the one! Told you it had a Y in it!

Numisi
13
Years of Service
User Offline
Joined: 27th Jul 2012
Location:
Posted: 30th Aug 2013 12:59
Yeah thank you! I couldn't find such command in the command list, now I see it! If I understood them correctly, can they be used to animate ragdoll players too? If it's right it sounds cool, but is there a command to deactivate the pin too? For example, if the player gets hit, it returns a free ragdoll and undergoes the physical forces?
Numisi
13
Years of Service
User Offline
Joined: 27th Jul 2012
Location:
Posted: 30th Aug 2013 16:44
I'm having trouble calibrating the movement... It always looks like walking on soap, because it takes a lot to start moving, and then moves very fast. With big forces pushing towards it starts fast but then moves crazy fast, with little forces it moves ok but it takes a lot of time accelerating. Then the rotation is a problem too, torque works exactly that same way, and it looks like friction doesn't affect body's rotation, in fact it rotates continuously when hit or rotated with torque forces.
The object becomes blocked easily too, but unblocks when vertical impulse (used as jump) is applied.
Can anyone help me calibrate the forces to create a decent movement?
thenerd
17
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 30th Aug 2013 18:45
I understand exactly what you mean. I've had the same problem, it actually seems very difficult to set up a good movement system in Newton. The big problems are getting it to work timer-based, and setting up the friction and forces.

If you haven't already, I would look into setting up the rotation and movement to be linear velocities. check these commands:

NDB_NewtonBodySetVelocity
NDB_NewtonBodyGetVelocity
NDB_NewtonBodySetOmega
NDB_NewtonBodyGetOmega
NDB_NewtonBodySetLinearDamping
NDB_NewtonBodyGetLinearDamping
NDB_NewtonBodySetAngularDamping
NDB_NewtonBodyGetAngularDamping


The only thing I'm not yet sure how to do is setting the angle of a body to be an angle value, rather than rotating the body using SetOmega (linear rotation). NDB_NewtonBodySetMatrix supposedly works, but when using that in realtime the collision sometimes glitches out and doesn't work. It's tricky, you'll have to play around with it.

Numisi
13
Years of Service
User Offline
Joined: 27th Jul 2012
Location:
Posted: 31st Aug 2013 14:01
I've not tried yet damping, because I'm not really sure of what it is, but setting velocity or omega made the player get stuck even more than before :/
I see that the worst problem is that it gets stuck in the floor, so the solution would be to not touch it, so... you think the (more difficult) ragdoll approach would work better? I'm not sure of how to move it.

I haven't the demos because I downloaded 1.53 some time ago and I don't find them again. I downloaded 2.36 but cannot understand how to use it, I don't find executables nor anything I can open, and it doesn't say it is compatible with darkbasic...

Login to post a reply

Server time is: 2026-07-07 00:09:48
Your offset time is: 2026-07-07 00:09:48