Trouble with Vehicle Physics

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Trouble with Vehicle Physics

Postby ajung » Sun Jan 18, 2009 10:19 am

Hi there,

I am currently writing a car racing game using the "D" programming language and I am pretty new to the field of rigid body physics engines (despite I have implemented a parametric aircraft aerodynamics model a few years ago).

Because "D" cannot handle thiscalls, I have to use libraries with a pure C-interface.

- I started out with ODE, but the D bindings didn't work.
- I ported Tokamak from C++ to D, however I failed to resolve all data structures and some strange memory management tricks & casts. (took me one week full time in my spare time)
- I ported JigLib from C++ to D. It had clean memory management, but shortly before finishing it, I discovered, that the collision support was not consistent enough for a racing game. (took me another week full time in my spare time)
- So now I ended up here with Newton 1.53. It has a nice, clean C-interface with Vehicle dynamics, and - despite being closed source - is multi-platform. So it fits my needs quite well.

I have already created D bindings (tell me if you are interested - but they are not tested well), and it integrated very well into my OOP framework. Initial results looked very promising. Thereafter I was curious to see the Vehicle support in action.

Unfortunately, the Vehicle develops an instability when the tires contact the ground plane. See following video (time is slowed down by a factor of 10):

http://www.youtube.com/watch?v=6ik1TuytVZA

I have tried to understand the vehicle tutorial in the SDK, however it's hard to catch all the required calls, as the vehicle code is cluttered among many files in different directories. It is out of question, that the vehicle code is working very well, however it is hard to follow as a beginner.

Now my question: Has anyone seen this before? Could someone point out where to start looking for a solution? Most likely, some call is missing, but I don't know which one.

Edit:
My real name is Andreas Jung :).
ajung
 
Posts: 11
Joined: Sun Jan 18, 2009 8:22 am

Re: Trouble with Vehicle Physics

Postby agi_shi » Sun Jan 18, 2009 2:46 pm

PM Julio Jerez for a link to the Newton 2.0 betas (currently at beta 19). They are where it's at for support, no one bothers with 1.53 much anymore. Beta19 has support for a multi-body vehicle joint as well as a ray cast vehicle. There are some interface changes, but judging from your post you should have absolutely no trouble migrating from 1.53.
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Trouble with Vehicle Physics

Postby ajung » Sun Jan 18, 2009 3:26 pm

Thanks for the advice, I'll do that.
ajung
 
Posts: 11
Joined: Sun Jan 18, 2009 8:22 am

Re: Trouble with Vehicle Physics

Postby Julio Jerez » Sun Jan 18, 2009 4:59 pm

ajung wrote:- I started out with ODE, but the D bindings didn't work.
- I ported Tokamak from C++ to D, however I failed to resolve all data structures and some strange memory management tricks & casts. (took me one week full time in my spare time)
- I ported JigLib from C++ to D. It had clean memory management, but shortly before finishing it, I discovered, that the collision support was not consistent enough for a racing game. (took me another week full time in my spare time)
- So now I ended up here with Newton 1.53. It has a nice, clean C-interface with Vehicle dynamics, and - despite being closed source - is multi-platform. So it fits my needs quite well.


Desperate situations requieres desperate measures.
after so many false choises taking newton for a spin cannot possible make it worse. 8)
Julio Jerez
Moderator
Moderator
 
Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Trouble with Vehicle Physics

Postby ajung » Tue Jan 20, 2009 2:57 pm

Having now ported my code from 1.53 to 2.0, the problems still persists.

I have discovered, that the guy from the following posting has exactly the same problems as me: viewtopic.php?f=9&t=4755

It is striking, that he uses the same coordinate system as me (front=(0,1,0), up=(0,0,1)), and when you look closer, you notice that a lot of people having problems with vehicles, use this coordinate system as well.

Did anyone came across a solution to this problem? Maybe it's really a bug, probably related to a left-hand/right-hand-coordinate system fucqp or something.

Ideas anyone? The symptoms are clear: when I place the vehicles on the ground, they drive around normally without trouble. But whenever they enter "air" (either spawned in the air, or bounced into air due to collision), they start an unstable/accelerated spin until hitting the +inf fate.

P.S. normal bodies are OK, it must be the tires.

I'll continue to investigate, but I'm getting desperate.
ajung
 
Posts: 11
Joined: Sun Jan 18, 2009 8:22 am

Re: Trouble with Vehicle Physics

Postby Julio Jerez » Tue Jan 20, 2009 4:45 pm

That is not a bug, your tires are in the wrong position relative to the body.
you need to implemnet the debug display so eh you can see what is going on.
Julio Jerez
Moderator
Moderator
 
Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests