The other thing I'm doing with Newton (an FPS system) is going well. Yesterday, I tried something much simpler, yet it doesn't seem to be working. Here's my code.
sync on:sync rate 120
randomize timer()
BoxObj=2
EnvironmentObj=1
TurnSpeed#=1.0
EngineForce#=0
NDB_NewtonCreate
NDB_SetVector 0.0, -9.8, 0.0
NDB_SetStandardGravity
NDB_SetVector 1, -300.0, -200.0, -300.0
NDB_SetVector 2, 300.0, 200.0, 300.0
NDB_NewtonSetWorldSize
load object "environment_test.x", EnvironmentObj
Col = NDB_NewtonCreateTreeCollision ( EnvironmentObj )
Room = NDB_NewtonCreateBody ( Col )
NDB_NewtonReleaseCollision Col
Col = NDB_NewtonCreateBox( 1.0, 1.0, 3.0 )
Board = NDB_NewtonCreateBody( Col )
NDB_NewtonBodySetMassMatrix Board, 10.0
NDB_BuildMatrix 0.0, 0.0, 0.0, 0.0, 150.0, 0.0
NDB_NewtonBodySetMatrix Board
make object box BoxObj, 1, 1, 3
NDB_BodySetDBProData Board, BoxObj
NDB_BodySetGravity Board, 1
NDB_NewtonBodySetAutoFreeze Board, 0
do
`Wkey, Xaxis
if keystate(17)
NDB_SetVector 1, -TurnSpeed#, 0, 0
NDB_NewtonBodySetOmega Board
endif
`Skey, Xaxis
if keystate(31)
NDB_SetVector 1, TurnSpeed#, 0, 0
NDB_NewtonBodySetOmega Board
endif
`Akey, Yaxis
if keystate(30)
NDB_SetVector 1, 0, TurnSpeed#, 0
NDB_NewtonBodySetOmega Board
endif
`Dkey, Yaxis
if keystate(32)
NDB_SetVector 1, 0, -TurnSpeed#, 0
NDB_NewtonBodySetOmega Board
endif
if upkey()=1 then inc EngineForce#, 0.1
if downkey()=1 then inc EngineForce#, -0.1
NDB_SetVector 1, 0.0, 0.0, 0.0
NDB_SetVector 2, 0.0, EngineForce#, 0.0
NDB_BodyAddForceLocal Board
position camera object position x(BoxObj), object position y(BoxObj), object position z(BoxObj)
rotate camera object angle x(BoxObj)+30, object angle y(BoxObj), 0
move camera -10
`NDB_NewtonBodyGetVelocity Board
`y# = NDB_GetVector_Y()
`print y#
sync
loop
function NeverCalled()
if memblock exist(1) then delete memblock 1
endfunction
For some reason, the DBPro box object is at 0, 0, 0, despite being bound to the Newton "board" object, which should be at 0, 150, 0. Even with nothing to collide against, the Newton "board" doesn't seem to move, even by gravity. Any ideas? Thanks.
EDIT- sorry, forgot to note in the topic title. I'm using DBPro.