A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by Overhertz » Thu Jan 27, 2011 2:01 pm
is there a function or simpler method to addforce in a direction? to call several functions from newton dll so that i can apply force to a body in a direction seems a waste, if there is not, then i guess i'd like to request this function something like
NewtonBodyAddForceDir(NewtonBody, floatforce);
-

Overhertz
-
- Posts: 112
- Joined: Mon Jul 06, 2009 11:19 am
-
by Julio Jerez » Thu Jan 27, 2011 2:14 pm
in the force callback all you nee to do is add the force togethe with the gravity.
if teh force is applyied off teh center of mass then you calculaet the cros product wi the distance form teh center and add that as a torque
look in the FAQ in teh forum for an exlanation.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Overhertz » Thu Jan 27, 2011 2:24 pm
hi thanks for replying, i checked the FAQ section, but i couldn't find any threads related to this topic, and i dont think i quite understand.
-

Overhertz
-
- Posts: 112
- Joined: Mon Jul 06, 2009 11:19 am
-
by Julio Jerez » Thu Jan 27, 2011 3:10 pm
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Overhertz » Thu Jan 27, 2011 3:42 pm
well i've tried to implement it as from the thread you linked, but it doesnt seem to work i guess i don't quite get it.. anyways this is what i've done
- Code: Select all
obj := NewtonBodyGetUserData(body);
NewtonBodyGetMassMatrix(body, @Mass, @Inertia.x, @Inertia.y, @Inertia.z);
NewtonBodyGetMatrix(body, bodymat.pointer);
R := obj.modelNode.getBoundingBox.getCenter * IrrToNewton; //will
bodymat.rotateVect(Torque, getVector3df(obj.vehicleTorque,obj.vehicleTorque,obj.vehicleTorque)*100); //
bodymat.transformVect(outPoint, R);
outPoint := outPoint - bodymat.getTranslation^;
Torque := Torque.crossProduct(outPoint);
WriteLn(Vector3dToStr(@Torque)); //debug
//output //maybe torque can be combined with torque ???
Force := getvector3df(0, Gravity * Mass, 0);
NewtonBodyAddForce(body, @Force.X);
NewtonBodyAddTorque(body, @Torque.x);
basically it needs to help force the vehicle in the direction it is headed (obviously) my car works good so far, but is slow, takes its time to get up to speed, so i need momentum and forces i guess.
any ideas
-

Overhertz
-
- Posts: 112
- Joined: Mon Jul 06, 2009 11:19 am
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 0 guests