Reset body

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Reset body

Postby doggyboy » Tue Feb 24, 2009 9:57 am

Hi,

I'm still working on my airhockey game and up till now Newton is doing a great job!

When the puck hits the goal, I want to reset the puck to its original position in the middle of the field. It's easy to reset the actual position with NewtonBodySetMatrix, but I'm not able to reset the forces ass well. It seems that NewtonBodySetForce only adds another force vector. Fore instance NewtonBodySetForce( body, [0, 0, 0]) will only reset the external force, but will not eliminate the internal force caused by collisions in the world.
I've also tried another solution. I've reset the position with NewtonBodySetMatrix and freezed the body with NewtonWorldFreezeBody. The next frame I unfreezed the body and all the forces seemed to have disappeared. But after a second or so all the physics stopped working. My program didn't crash, but all my bodies stopped moving.

Is there a right way to reset a body to a specified position, so that no forces are working on it? The body has to stand still.

Greetz,
Benji
doggyboy
 
Posts: 4
Joined: Wed Jun 25, 2008 3:02 pm

Re: Reset body

Postby Dave Gravel » Tue Feb 24, 2009 11:12 am

I don't have try but maybe your better to reset the matrix + omega and velocity.
Good luck.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Reset body

Postby doggyboy » Tue Feb 24, 2009 12:07 pm

I've set the Omega, Velocity and Torque to zero and it works fine!

Thanks for your help, Dave!
doggyboy
 
Posts: 4
Joined: Wed Jun 25, 2008 3:02 pm

Re: Reset body

Postby Aphex » Thu Feb 26, 2009 5:18 pm

That reminds me... I use the multi-body vehicle joint, and when I 'rescue' the vehicle I set its torque, omega & velocity to zero, yet sometimes it still has a rotational velocity. Anyone else experienced this?
Aphex
 
Posts: 144
Joined: Fri Jun 18, 2004 6:08 am
Location: UK

Re: Reset body

Postby Julio Jerez » Thu Feb 26, 2009 5:46 pm

you will also have to reset the velocity for each of the tires.
they are bodies and they will drive the car if they mass if high relative to the body mass.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Reset body

Postby Dave Gravel » Thu Feb 26, 2009 5:48 pm

Its more complex with any object having a joint, because it have all times little delay between the joint and the object and it return some extra force.
Maybe you can make it mass zero and change it and replace the mass, but it seen like a lot tricking.
I remember in the pass to have use multibody and normally i change only the matrix rotation but i don't remember to have try in runtime.
I can make some try me too and if I find a good way I let's you know.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Reset body

Postby Aphex » Fri Feb 27, 2009 6:26 am

Ah that makes sense - I'll give it a go.
Aphex
 
Posts: 144
Joined: Fri Jun 18, 2004 6:08 am
Location: UK


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 19 guests

cron