how to cancel forces? (1.53)

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

how to cancel forces? (1.53)

Postby ammoises » Thu Apr 16, 2009 9:08 pm

Hello everyone.

I am using Newton 1.53 and my problem is the following, I have a sphere that is moving with some speed, and want that when I press a key the sphere stop moving and stop exactly where you are.

Try to cancel the forces as follows.

Option 1:

dFloat Torque[3];
dFloat Force[3];

Force[0]=0;
Force[1]=0;
Force[2]=0;

Torque[0]=0;
Torque[1]=0;
Torque[2]=0;

NewtonBodySetForce(sphere.body,Force);
NewtonBodySetTorque(sphere.body,Torque);

Option 2:

dFloat Torque[3];
dFloat Force[3];

NewtonBodyGetForce(sphere.body,Force);
NewtonBodyGetTorque(sphere.body,Torque);

Force[0]=(-1)*Force[0];
Force[1]=(-1)*Force[1];
Force[2]=(-1)*Force[2];

Torque[0]=(-1)*Torque[0];
Torque[1]=(-1)*Torque[1];
Torque[2]=(-1)*Torque[2];

NewtonBodyAddForce(sphere.body,Force);
NewtonBodyAddTorque(sphere.body,Torque);

Option3:

NewtonBodyGetMatrix(sphere.body,mat);

mat[0]=(-1)*mat[0];
mat[1]=(-1)*mat[1];
mat[2]=(-1)*mat[2];
mat[3]=(-1)*mat[3];

mat[4]=(-1)*mat[4];
mat[5]=(-1)*mat[5];
mat[6]=(-1)*mat[6];
mat[7]=(-1)*mat[7];

mat[8]=(-1)*mat[8];
mat[9]=(-1)*mat[9];
mat[10]=(-1)*mat[10];
mat[11]=(-1)*mat[11];


NewtonBodySetMatrix(sphere.body,mat);


But in three cases the sphere still moving

Someone can give me an idea of how I cancel the forces?
ammoises
 
Posts: 2
Joined: Mon Dec 31, 2007 1:09 pm

Re: how to cancel forces? (1.53)

Postby Dave Gravel » Fri Apr 17, 2009 3:06 am

You have try the omega too ?
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: how to cancel forces? (1.53)

Postby ammoises » Fri Apr 17, 2009 4:45 pm

I forget the variable Ogema, sorry and thanks for reply
ammoises
 
Posts: 2
Joined: Mon Dec 31, 2007 1:09 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 11 guests

cron