Well after bashing the code to death have almost got it do the moves it needs.
I have back and fore wards, strafe left/right, and almost rotate left right, it sometimes work and then rolls around.
here the code its the modified version of the character controller demo with dynamic body instead.
` set up general properties
phy enable debug
sync on
sync rate 60
autocam off
phy start
set camera range 0.5, 30000
hide mouse
` move into the media directory
set dir "media"
` load the level and make a static mesh for it
load object "universe.dbo", 1
set object light 1, 0
phy make rigid body static mesh 1
` load our skybox
load object "skybox2.x", 2
set object light 2, 0
set object texture 2, 3, 1
scale object 2, 30000, 30000, 30000
` come out of the media directory
set dir ".."
` create our box controller
make object box 3, 20, 50, 20
make object box 4 ,20,50,20
position object 3,434,42,-517
phy make rigid body dynamic box 3
phy set rigid body position 3,434,42,-517
`phy make box character controller 3, 434, 42, -517, 10, 35, 10, 1, 10.5, 45.0
hide object 3
phy set rigid body angular damping 3,5.0
phy set rigid body linear damping 3,5.0
` display Dark Physics logo
load image "logo.png", 100000
sprite 1, 0, 600 - 60, 100000
` our main loop
do
` display instructions
set cursor 0, 0
print "Using Dark Physics for collision detection of an FPS Creator level"
print "Use the arrow keys and mouse to move around"
` rotate and position the camera based on the box controller
position camera object position x ( 3 ), object position y ( 3 ), object position z ( 3 )
position object 4,object position x ( 3 ), object position y ( 3 ), object position z ( 3 )
rotate camera object angle x ( 4 ), object angle y ( 4 ), object angle z ( 4 )
` phy set rigid body rotation 3,object angle x ( 4 ), object angle y ( 4 ), object angle z ( 4 )
` OldCamAngleY# = CameraAngleY#
` OldCamAngleX# = CameraAngleX#
` CameraAngleY# = wrapvalue ( CameraAngleY# + mousemovex ( ) * 0.4 )
` CameraAngleX# = wrapvalue ( CameraAngleX# + mousemovey ( ) * 0.4 )
` yrotate object 4, curveangle ( CameraAngleY#, OldCamAngleY#, 24 )
` xrotate object 4, curveangle ( CameraAngleX#, OldCamAngleX#, 24 )
` react to key presses and move the controller
key = 0
if upkey ( )
key = 1
phy add rigid body force at local 3,0,0,100,0,-10,0,2
` phy move character controller 3, 200.0
endif
if downkey ( )
key = 1
phy add rigid body force at local 3,0,0,-100,0,-,10,2
` phy move character controller 3, -200.0
endif
if leftkey ( ) and shiftkey()
key = 1
phy add rigid body force at local 3,-100,0,0,0,-10,0,2
` phy move character controller 3, 200.0
endif
if rightkey ( ) and shiftkey()
key = 1
phy add rigid body force at local 3,100,0,0,0,-10,0,2
` phy move character controller 3, -200.0
endif
if leftkey ( )
key = 1
rotate object 4,object angle x(3), object angle y(4)-1,object angle z(3)
phy set rigid body rotation 3,object angle x(4),object angle y(4),object angle z(4)
rotate object 4,object angle x(3),object angle y(3),object angle z(3)
endif
if rightkey ( )
key = 1
rotate object 4,object angle x(3), object angle y(4)+1,object angle z(3)
phy set rigid body rotation 3,object angle x(4),object angle y(4),object angle z(4)
rotate object 4,object angle x(3),object angle y(3),object angle z(3)
endif
if shiftkey()
phy delete character controller 3
phy delete rigid body 3
phy delete trigger 3
endif
if key = 0
phy add rigid body force 3,0,0,0,0,0,0,2
` phy move character controller 3, 0.0
endif
if spacekey()
phy delete character controller 3
phy delete rigid body 3
phy delete trigger 3
phy make box character controller 3, 434, 42, -517, 10, 12.5, 10, 1, 10.5, 45.0
endif
` phy set rigid body rotation 3,object angle x ( 4 ), object angle y ( 4 )-180, object angle z ( 4 )
` update the simulation and screen
phy update
sync
loop
if someone wants to have ago at getting the last bit going then you'll have a working system.
Dark Physics makes any hot drink go cold.