Conservation of energy in samples?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Conservation of energy in samples?

Postby sgb27 » Fri Mar 27, 2009 11:55 am

I have only just started looking here as I would like to replace my hand-coded physics code in my game with a more stable and reliable library.

I have been looking through the samples of the 2.0 beta and playing about with the code, but one thing niggles me. In the "raycast car" demo where you can drive about the monster truck, the jeep and the F1 car, it seems like you can do the physically impossible. If you drive the F1 car or the Jeep into the monster truck at very low speed you can lift the whole monster truck several metres into the air!! I thought maybe the masses were not realistic, so I changed the monster truck mass to 10 tons but still if you gently bump into it you can lift it into the air with a car weighing 20 times less - it just feels like the monster truck is massless!

Is this just because of the inaccurate model in the demo app somehow or somewhere, or am I unlikely to be able to get around this problem if I use Newton in my game?

Thanks.
sgb27
 
Posts: 3
Joined: Fri Mar 27, 2009 11:44 am

Re: Conservation of energy in samples?

Postby Dave Gravel » Fri Mar 27, 2009 12:48 pm

This vehicle is experimental if you read the source comments.
The source is show for let's people fix or change the code for your need...
This code is write and modified by me and yes it have some problem again.
With some vehicle models it can work perfect without big ressources use,
but in some special case it need a bigger[better] implementation.
The problem that you say can come fixed for sure but it can need more coding too.

With raycast vehicle it's hard to control collision with the tires from other objects in the scene.
You need to calcul velocity and all force and mass in coming to reproduce the good desired effect.

Maybe your better to use the multibody vehicle, or make the desired modification in the raycast vehicle code.
The character control is a exemple about how complex can come a vehicle raycast implementation with normal tire collision behaving...
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: Conservation of energy in samples?

Postby sgb27 » Fri Mar 27, 2009 1:40 pm

Thanks for your comments! Can you give me a quick explanation of the difference between the raycast and multi-body vehicle, I couldn't find an explanation anywhere.

I was under the impression that I would just create a rigid body for the car main body, each wheel and maybe some suspension elements, then link them all together with constraints and let Newton do the hard work each frame. I would calculate the forces on the tyre contact patch based on the velocity information using Pajeka or similar.

Is this possible, it sounds like I would have to do a lot of work myself to get a realistic simulation?
sgb27
 
Posts: 3
Joined: Fri Mar 27, 2009 11:44 am

Re: Conservation of energy in samples?

Postby Dave Gravel » Fri Mar 27, 2009 3:06 pm

MultibodyVehicle do exactly what you need.
It working normally because the tire is real body dynamic and they are connected with special tire joints row.
The only problem you are more limited about the vehicle count in a scene.
I have already make a scene with around 20 multibodyvehicle and the speed staying pretty good.
This multibody vehicle is a super joint because it working good with solver model 1 without so much delaying.
You need to take care too about what simulation type that you need.
Exemple you need vehicle running at very high speed, you need to use high newton framerate around 100 and more...
More the newton framerate is high more it costing process and more the vehicle count is limited.
If you not need very high speed vehicle you can let's the default newton framerate at 60 and have more vehicle in a scene.
You can comparate the multibody vehicle with the old 1.53 vehicle but now it's possible to totally change the code with 1.53 you can't change any code about vehicle.

If you make a simulation realistic with only one vehicle use solver model 0 it cost a lot more when you have many object but the simulation is more precise and the multibodyvehicle behav a little bit better on this solver.
If you need to create a game with action and multiple objects use solver model 1.

The raycast vehicle is normally more use for make trafic and AI,
but a good and complet implementation can come use like principale behavor vehicle in a game.
Raycast vehicle don't have tires dynamic body, it have only a collision shape.
Some really basic raycast vehicle don't have collision shape at all only a point force.
You need to control this collision shape by hand, it's a little bit like use newton with custom collision without dynamic mode.
Like I have say you need to make all result collision by hand from the received collision info,
for control the raycast and the collision from other objects in the scene.
Maybe you can use some quick cheat in the code for reduce this undesired effects, but it depend a lot from the environment too.

My personal suggestion:
If you make a vehicle game, start to make your level racing track and after you can see more what type of vehicle simulation that you really need.
From this you can implement a raycast vehicle in your level mix with your multibodyvehicle.
After have make tests and see how it go, you can try to patch the raycast vehicle for your exact need.
I say this for raycast vehicle but you can play with the multibody vehicle code too, exemple you like to broken a tire you modify the code to ignore this tire in the joint pass....

Vehicle simulation is not a simple task, and it depending a lot from the environment where it is used.
Many situation can request a personal implementation.
I think it's very important to understand this first.

Edited:
I currently work on a inteligent material surface sorting for my engine and I back really soon for work on my vehicle implementation.
Maybe I can try to fix some stuff like the problem that you say,
but remember you the raycast vehicle in coming in the current beta 2 demo is from Julio but modifed by me and it is not the default newton vehicle method...


Good luck.
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: Conservation of energy in samples?

Postby sgb27 » Sat Mar 28, 2009 6:48 am

Thanks again for the detailed reply, at the moment I am just going for a single vehicle at quite low speeds, but it should be accurate over quite bumpy terrain. So it seems like the multibody vehicle with solver model 0 will be best. Anyway, time to get experimenting with actual code now!
sgb27
 
Posts: 3
Joined: Fri Mar 27, 2009 11:44 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 13 guests

cron