|
Post by zilchvortex on Mar 3, 2009 18:40:11 GMT 1
Im new to newtons physics dll and i have a problem. When i try to move an object i just want it to slide using wasd like a charecter and i want to stop the rotation of the object heres my code :- sync on:sync rate 60
NDB_NewtonCreate
Co1 = NDB_NewtonCreateBox( 100.0, 10.0, 100.0 )
box1 = NDB_NewtonCreateBody( Co1 )
make object box 1, 100,10,100 position object 1,0,-20,0
NDB_buildmatrix 0,0,0,0,-20,0 NDB_NewtonBodySetMatrix box1
NDB_BodySetDBProData box1, 1
make object cube 2, 10
Col = NDB_NewtonCreateBox( 10.0, 10.0, 10.0 )
Cube = NDB_NewtonCreateBody( Col )
NDB_BuildMatrix 0,0,0,0,0,0 NDB_NewtonBodySetMatrix cube
NDB_CalculateMIBoxSolid 10 NDB_NewtonBodySetMassMatrix Cube, 10
NDB_BodySetDBProData Cube, 2
NDB_BodySetGravity Cube,1
NDB_NewtonBodySetAutoFreeze cube,on do ndb_setvector 2,0,0,0 control camera using arrowkeys 0 ,1,1 NDB_se if keystate(2) then NDB_SetVector 2,0,0,10 if keystate(31) then NDB_SetVector 2,0,0,-10 if keystate(30) then NDB_SetVector 2,-10,0,0 if keystate(33) then NDB_SetVector 2,10,0,0 if spacekey() then NDB_SetVector 2,0,10,0 NDB_BodyAddForceglobal Cube
NDB_NewtonUpdate sync
loop
Thank you.
|
|