New Tutorial: Integration with Newton Game Dynamics
New Tutorial: Integration with Newton Game Dynamics
http://www.mercior.com/tut-newton.shtml
In this tutorial I explain how to use newton to create realisitic object interaction with a BSP mesh. Enjoy
Niko - If you want to add this to the tutorial page you can link to my site or use the plain html included in the example zip. I don't mind
In this tutorial I explain how to use newton to create realisitic object interaction with a BSP mesh. Enjoy
Niko - If you want to add this to the tutorial page you can link to my site or use the plain html included in the example zip. I don't mind
.: http://www.mercior.com :.
collision hierarchy?
Cool, thanks for the tutorial.
does newton allow to hierarchically define collision geometries? i think that would be a big PLUS for newton game dynamics especially if used with irrlicht. ODE doesn't allow that
cheers
gorgon
does newton allow to hierarchically define collision geometries? i think that would be a big PLUS for newton game dynamics especially if used with irrlicht. ODE doesn't allow that
cheers
gorgon
-
- Posts: 118
- Joined: Thu Sep 18, 2003 10:05 pm
- Location: switzerland
Got some problems with it.
I edited your code to remove the cubes and add a single car instead.
It collides with the map and everything, and i can throw it up in the air with a mouseclick.
But it often sinks through the floor.
I tried to decrease the values to NewtonCreateBox() and it helped a little, but not always.
Got any idea of what i could do to make it stay inside the map at alla times?
Also, when i first loaded the car into irrlicht it was drawn correctly, but after hooking it up to newton it was upside down. So i had to add mat.setRotationDegrees ( vector3df(180,0,0) );
to make it appear correctly.
Could that have someting to do with that fall-through-the-floor problem?
And finaly, thanks for a great tutorial.
I edited your code to remove the cubes and add a single car instead.
It collides with the map and everything, and i can throw it up in the air with a mouseclick.
But it often sinks through the floor.
I tried to decrease the values to NewtonCreateBox() and it helped a little, but not always.
Got any idea of what i could do to make it stay inside the map at alla times?
Also, when i first loaded the car into irrlicht it was drawn correctly, but after hooking it up to newton it was upside down. So i had to add mat.setRotationDegrees ( vector3df(180,0,0) );
to make it appear correctly.
Could that have someting to do with that fall-through-the-floor problem?
And finaly, thanks for a great tutorial.
Hmmm, when you say "sinks through the floor" do you mean lands on the floor but part of the model is submerged? Or is it just falling through the floor?
If it is landing but submerged, you'll have to increase the size of the newton box to match that of the model.. You could write some code that can determine the size of the newton box based off the irrlicht bounding box perhaps?
As for the model rotation, its just unlucky Your choices are either to open the model in a 3D editor and rotate it 180 degrees, or you could store an angle offset along with your newton objects to ensure that they're oriented correctly.
Newton is still on its first release so the SDK currently doesnt have any joints or vehicle code. The new version is due before the end of the month and promises vehicles, joints and some ragdoll-specific stuff I'll see about writing up a new tutorial when it comes out.
If it is landing but submerged, you'll have to increase the size of the newton box to match that of the model.. You could write some code that can determine the size of the newton box based off the irrlicht bounding box perhaps?
As for the model rotation, its just unlucky Your choices are either to open the model in a 3D editor and rotate it 180 degrees, or you could store an angle offset along with your newton objects to ensure that they're oriented correctly.
Newton is still on its first release so the SDK currently doesnt have any joints or vehicle code. The new version is due before the end of the month and promises vehicles, joints and some ragdoll-specific stuff I'll see about writing up a new tutorial when it comes out.
.: http://www.mercior.com :.
I did this to set the size. I think it works, because when the car is upside down and on the floor. The lowest parts of the wheels is visible.
And it falls through the floor. completley. and continues into the void.
But sometimes it gets stuck inside the floor, madly twisting and turning until it gets completley through.
And if i throw it, it will most of the time fly through the walls too.
That rotation code i posted earlier works for the rotation issue. Guess i could stick with it. No big problems there.
Code: Select all
aabbox3df box = wnode->getTransformedBoundingBox();
vector3df size = box.MaxEdge - box.MinEdge;
collision = NewtonCreateBox(nWorld, size.X, size.Y, size.Z, NULL);
But sometimes it gets stuck inside the floor, madly twisting and turning until it gets completley through.
And if i throw it, it will most of the time fly through the walls too.
That rotation code i posted earlier works for the rotation issue. Guess i could stick with it. No big problems there.
if its flying through walls and floors then either the box's dimensions are wrong, or its mass / inertia ratio is wrong. Have you altered the mass of the box?
Try printf()ing the size vector to check the values are ok.
Try printf()ing the size vector to check the values are ok.
.: http://www.mercior.com :.
Yes i altered the mass/inertia thingies. Was that bad of me?
Actually, i had no idea what that was for, well i know what "mass" is but not the other things, so i tried to randomly increase/decrease it to see if it had any effect. (Most of the time i program with an trial-and-error approach, when i dont have any clue what i am doing )
I did this because i used different sizes than the cubes had, so i figured i should probably change that one too.
What is the correct way to get that ratio? Got anything to do with the size of the object?
And i'm going to check those values.
Actually, i had no idea what that was for, well i know what "mass" is but not the other things, so i tried to randomly increase/decrease it to see if it had any effect. (Most of the time i program with an trial-and-error approach, when i dont have any clue what i am doing )
I did this because i used different sizes than the cubes had, so i figured i should probably change that one too.
What is the correct way to get that ratio? Got anything to do with the size of the object?
And i'm going to check those values.
very cool tutorial! thanks! ...i think newton described the cause of your problem here -> http://www.physicsengine.com/forum/view ... =1112#1112
Yes newton explains the inertia matrix values on page 1 of that thread I think
Also his latest post explains how to get past a rotation bug in the irrlicht matrix - you might have noticed in my example sometimes cubes on the floor flicker at a different angle for a frame or 2.. I'll update the tutorial later
Also his latest post explains how to get past a rotation bug in the irrlicht matrix - you might have noticed in my example sometimes cubes on the floor flicker at a different angle for a frame or 2.. I'll update the tutorial later
.: http://www.mercior.com :.
-
- Posts: 292
- Joined: Sun Mar 14, 2004 5:28 pm
- Location: Germany
- Contact:
Looks great! I'm going to read it throug after meal
http://www.games-forge.de - Die Community für Nachwuchsprogrammierer