Move vehicle forward when it is completely stopped

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Move vehicle forward when it is completely stopped

Postby Matic » Thu May 19, 2011 11:42 am

Hello,

when my CustomMultBodyVehicle stops, I cannot move it forward again with function: CustomMultBodyVehicleApplyTorque. When it stops, it is completely dead. How can I move forward CustomMultiBodyVehicle from 0 speed? Is this a bug in Newton?

I am using this function to apply tourque JOINTLIBRARY_API void CustomMultiBodyVehicleApplyTorque (NewtonUserJoint *car, int tireIndex, dFloat torque);
Matic
 
Posts: 15
Joined: Fri Apr 08, 2011 8:23 am
Location: Ljubljana, Slovenia

Re: Move vehicle forward when it is completely stopped

Postby Sweenie » Thu May 19, 2011 2:02 pm

It's probably going to sleep because it haven't moved for some time.
Applying torque should wake a body up, but since the torque applied to the tires are applied inside the contraint this won't
happen since the constraint stops working when the body falls asleep.

Try the following function on the chassi body to prevent it from going to sleep.

NewtonBodySetAutoSleep (const NewtonBody* body, int state);
state = 1 means it will go to sleep when no movement is detected.
state = 0 means it will always be simulated.

or just apply a small impulse to it.
Sweenie
 
Posts: 503
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Move vehicle forward when it is completely stopped

Postby Matic » Sun May 22, 2011 4:05 pm

Thanks I will try that.I have another question. I am using CustomMultiBodyVehicle on iPad and it is using almost 100% percent of CPU. When I comment it out CPU usage falls down to 3% (all other physics objects and collision detection are still in the scene).
Code: Select all
struct iNewtonUserJoint* vehicle = [world CreateCustomMultiBodyVehicle:&chassisMatrix.m_front.m_x :&chassisMatrix.m_up.m_x :vehicleBody];


Then I addTires and use TireTransformCallBack to draw them.

Any ideas? Is there problem with CustomMultiBodyVehicle perhaps?
Matic
 
Posts: 15
Joined: Fri Apr 08, 2011 8:23 am
Location: Ljubljana, Slovenia

Re: Move vehicle forward when it is completely stopped

Postby JernejL » Mon May 23, 2011 2:15 am

The multibody vehicle might be too much cpu intensive for ipad to handle. Try the raycast vehicle instead?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Move vehicle forward when it is completely stopped

Postby Matic » Mon May 23, 2011 4:06 am

Hi,

thanks for answer. RayCastVehicle isn't available in Newton 2.33 :(. Any other options?
Matic
 
Posts: 15
Joined: Fri Apr 08, 2011 8:23 am
Location: Ljubljana, Slovenia

Re: Move vehicle forward when it is completely stopped

Postby banjkeee » Wed Aug 24, 2011 8:05 am

Any other options?

Use 2.20
banjkeee
 


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest