well this sort of works, it the character controller demo modified to show this working, only thing I can't work out is why i have to wait for the rotating object to do one rotation before it work right.
` this program shows how to load an FPS Creator level
` and walk around it using the character controller
` set up general properties
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
phy make box character controller 3, 434, 52, -517, 10, 35, 10, 1, 10.5, 45.0
hide object 3
MAKE OBJECT box 5,50,5,50
color object 5,rgb(0,250,0)
position object 5,434,40,-517
phy make rigid body dynamic box 5
` 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#=wrapvalue(rotate#+0.2)
phy set rigid body rotation 5, 0, rotate#, 0
print PHY GET COLLISION DATA()
print "type = ",PHY GET RIGID BODY TYPE(3)
` rotate and position the camera based on the box controller
position camera object position x ( 3 ), object position y ( 3 ) + 20, object position z ( 3 )
rotate camera object angle x ( 3 ), object angle y ( 3 ), object angle z ( 3 )
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
CameraAngleY# = wrapvalue ( CameraAngleY# + mousemovex ( ) * 0.4 )
CameraAngleX# = wrapvalue ( CameraAngleX# + mousemovey ( ) * 0.4)
while PHY GET COLLISION DATA()=1
phita=PHY GET COLLISION OBJECT A()
phitb=PHY GET COLLISION OBJECT b()
print phita
print phitb
print PHY GET COLLISION COUNT(3)
if phita=5 and phitb=3
yrotate object 3, curveangle ( CameraAngleY#, (OldCamAngleY#+rotate#), 24 )
else
yrotate object 3, curveangle ( CameraAngleY#, (OldCamAngleY#), 24 )
endif
endwhile
xrotate object 3, curveangle ( CameraAngleX#, OldCamAngleX#, 24 )
` react to key presses and move the controller
key = 0
if upkey ( )
key = 1
phy move character controller 3, 200.0
endif
if downkey ( )
key = 1
phy move character controller 3, -200.0
endif
if key = 0
phy move character controller 3, 0.0
endif
` update the simulation and screen
phy update
sync
loop
Dark Physics makes any hot drink go cold.