Moving an object arbitrarily

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Moving an object arbitrarily

Postby yoshi » Sun Apr 10, 2011 4:42 am

Hi everyone!

I'm new to this forum but I've been playing with newton for a few months and I'm really impressed how simple to use
yet powerful is this library :D

Coming to my question, what I'm trying to do is to move arbitrarily an object in the scene which doesn't really follow any physics rule,
but I still need to do some collision with. (I'm using OgreNewt)
This object just walks back and forward on a predefined path.

I thought I could manually set its LinearVelocity or its position every frame but newton is warning me this may be unsafe.

What is the correct way of doing this?

Thanks!
yoshi
 
Posts: 4
Joined: Sun Apr 10, 2011 4:27 am

Re: Moving an object arbitrarily

Postby JoeJ » Sun Apr 10, 2011 6:37 am

Set force ant torque instead of linear and angular velocity.
Take a look at rattus thread "Limiting angular speed" a few posts below, to see how to convert the angular part.
For the linear part it is: force = (targetLinVel - currentLinVel) * (mass / timestep);

On Wiki there is also an example using the kinematic joint to constrain something to a path, as i remember.
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Moving an object arbitrarily

Postby Julio Jerez » Sun Apr 10, 2011 8:26 am

newton warn you that setting velocity is unsafe?
I was not awere the engien did that? how?

in newton 2.00 and up setting velocity is a legitimate way to move a body,
you can also use the Pathfollow joint, and the you can set the position in the joint and the joint will do the job of calculating the force to achive the final position
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Moving an object arbitrarily

Postby yoshi » Sun Apr 10, 2011 8:59 am

Thanks a lot for the fast replies! :D

It wasn't really newton but OgreNewt which warned me that setting position/velocity manually would break physics rules.
I guess that depends on how you use that function after all :wink:

Wow, thats' great! I didn't know of this pathfollow joint. I think I'll have a look to the joints demo which comes with OgreNewt :wink:
yoshi
 
Posts: 4
Joined: Sun Apr 10, 2011 4:27 am

Re: Moving an object arbitrarily

Postby JoeJ » Sun Apr 10, 2011 10:10 am

in newton 2.00 and up setting velocity is a legitimate way to move a body


:shock: I didn't know that this is ok. That may be important to me...

I quickly changed my powered ragdoll stuff to apply angular velocities instead of torques.
The advantage is that there is no unwanted swinging motion (nice!),
but the drawback is that the joints (custom, similar to ball and socket) can't keep up to keep the bones together.

So i guess the constraint solver still does not like the manual changing of velocities on systems of joined bodies?
Julio, can you give some details about that?
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests