PDA

View Full Version : Converting From ODE to Newton



technomage
12-11-2006, 10:02 PM
Hi

I am converting a project from ODE to newton and I am having some trouble with a few functions.

ODe has a function

dBodyAddRelForceAtRelPos

Which applys a force at a relative position in the objects local space. I use this function to simulate a thruster firing on the space ship at a certain point on the space craft.

Now newton does not seem to have a similar function. Any ideas on how I write a version of this function myself :?:

I know I have to use the NewtonBodyAddForce in the ForceAndTorqueCallback but this appears to only support adding a force, or torque at the center of the body.

What I am trying to simulate is fairly accurate physics on a space ship. each thruster will apply it's force in a certain direction at a certain point on the body, th idea being that is a thruster gets damaged the control of the craft will alter.

can anyone help?

JernejL
12-11-2006, 10:24 PM
You could search a little better, i asked same question on newton forum a while back ;)

http://newtondynamics.com/forum/viewtopic.php?t=2976

technomage
12-11-2006, 10:38 PM
I have seen that post already, I was just wondering if there was a better way. ODE seemed to handle much of this kind of stuff for you (or provide an API for it) it appears that with newton you have to do allot of the leg work yourself, not that I mind doing the leg work, but I hadn't banked on having to do it.

You might say, stick with ODE then, and I would but it does not support the platforms I want to deploy on :cry: and it hasn't been updated for ages.

JernejL
12-11-2006, 11:32 PM
if newton would that for you the code would be probably the same..

maybe you need newtonbodyaddimpulse?

tux
13-11-2006, 05:57 PM
newtonbodyaddimpulse?

an impulse is not the same as a force, do not use this as a replacement.

if you dont like the newton api then mabey the best thing is to stay with ode, but i prefer julio (the newton dev) to focus his work on the core features instead of adding helper functions

savage
13-11-2006, 07:01 PM
Maybe what is required is a 3rd Party wrapper that wraps both ODE and Newton APIs into a more standard set of method calls. Then during the class creation you can just pass an enumeration type that defines which Physics library you prefer to use. That way your app/game only talks to wrapper, and underneath does the appropriate calls. Almost like an SDL for Physics libraries :).

JernejL
13-11-2006, 09:07 PM
Maybe what is required is a 3rd Party wrapper that wraps both ODE and Newton APIs into a more standard set of method calls. Then during the class creation you can just pass an enumeration type that defines which Physics library you prefer to use. That way your app/game only talks to wrapper, and underneath does the appropriate calls. Almost like an SDL for Physics libraries :).

if it has a raycast car in it, it is the winner :P

technomage
13-11-2006, 10:46 PM
an impulse is not the same as a force, do not use this as a replacement.


Ok, thanks for the tip :D





if you dont like the newton api then mabey the best thing is to stay with ode, but i prefer julio (the newton dev) to focus his work on the core features instead of adding helper functions

I do like the newton API, it's very clean and I like the interface. I also agree that julio should keep focusing on the core, it would be nice like Dom said to have a unit which wraps all of the helper functions up to save time.

I think see a newtonhelper.pas in my future. :P

tux
14-11-2006, 05:11 PM
I've made a few helper functions, take a look at RagePhysics at https://sourceforge.net/projects/rage-engine/ (the cvs is way more up to date then the file release).

I've got most of December off work, so hopefully i can get back to adding things to it :D