Post by JBar00 on Apr 30, 2007 7:18:13 GMT 1
Hello.
I've been having a problem with using newton collision with terrain in DBPro. I'm using the March 10, 2005 version of the DLL and DBPro 6.3.
The problem is that objects collide and then start to slowly fall through the terrain. For some reason spheres are the only objects that don't have the problem. The two that have been bothering me the most are cylinders and convex hulls. Both of them will collide with the world and then slowly start to sink through the floor.
Here is how I'm setting up the convex hull.
Here's how I'm setting up the cylinder.
I've been having a problem with using newton collision with terrain in DBPro. I'm using the March 10, 2005 version of the DLL and DBPro 6.3.
The problem is that objects collide and then start to slowly fall through the terrain. For some reason spheres are the only objects that don't have the problem. The two that have been bothering me the most are cylinders and convex hulls. Both of them will collide with the world and then slowly start to sink through the floor.
Here is how I'm setting up the convex hull.
function MakeConvexHull(x#,y#,z#,rx#,ry#,rz#,mass#)
`Step 1- Load in an object to be used to create the convex hull
obj = FreeObject()
load object "Model/bowlpinGREEN/BowlPinTest.x", obj
`Step 2- Here's where we create the convex hull collision data.
Col = NDB_NewtonCreateConvexHull( obj )
`Step 3- make the rigid body as normal, from the Collision data.
Body = NDB_NewtonCreateBody(Col)
`Step 4- we must set the mass, and Moment of Inertia
sx# = object size x(obj)
sy# = object size y(obj)
sz# = object size z(obj)
NDB_CalculateMIBoxSolid mass#, sx#, sy#, sz#
NDB_NewtonBodySetMassMatrix Body, mass#
NDB_NewtonReleaseCollision Col
`Set initial position and rotation
NDB_BuildMatrix rx#, ry#, rz#, x#, y#, z#
NDB_NewtonBodySetMatrix Body
NDB_NewtonBodySetDestructorCallback Body
NDB_BodySetDBProData Body, obj
position object obj, x#, y#, z#
NDB_BodySetGravity Body, 1
endfunction Body
Here's how I'm setting up the cylinder.
function MakeCylinder(x#,y#,z#,radius#,height#,mass#)
Col = NDB_NewtonCreateCylinder(radius#,height#)
Body = NDB_NewtonCreateBody(Col)
`Set initial position and rotation
NDB_BuildMatrix 0.0, 0.0, -90.0, x#, y#, z#
NDB_NewtonBodySetMatrix Body
`I calculate the MI (moment of inertia) for a cylinder shape.
NDB_CalculateMICylinderSolid mass#, radius#, height#
NDB_NewtonBodySetMassMatrix Body, mass#
NDB_NewtonReleaseCollision Col
obj = FreeObject()
load object "Model/bowlpinGREEN/BowlPinTest.x", obj
position object obj, x#, y#, z#
NDB_BodySetDBProData Body, obj
NDB_NewtonBodySetDestructorCallback Body
NDB_BodySetGravity Body, 1
endfunction Body