I get strange result with this piece of code :
` DBP Setup.
autocam off
sync on
sync rate 60
Color Backdrop 0
`backdrop off
` Initialize PhysX Engine.
phy start
phy set gravity 0, -9.8, 0
` Create the ground.
make object plain 1, 30000, 30000
color object 1, rgb(20, 120, 20)
xrotate object 1, -90
phy make rigid body static box 1
` Create the player.
make object box 2, 100, 100, -200
phy make box character controller 2, 100, 100, -200, 10, 50, 10, 1, 16, 45
hide object 2
rem a few boxes
for boxes = 3 to 20
make object box boxes, 20, 20, 20
position object boxes, 30 * boxes, 60, 0
color object boxes, rgb(64 + rnd(127), 64 + rnd(127), 64 + rnd(127))
phy make rigid body dynamic box boxes
phy set rigid body mass boxes, 1000.0
next boxes
Repeat
UDKey = UpKey() - DownKey()
LRKey = RightKey() - LeftKey()
MCKey = ( MouseClick() - 1.5 ) * 2.0
` Rotate the player using mouse movements.
oldcamx = camx : camx = wrapvalue( camx + mousemovey() * 0.4 )
oldcamy = camy : camy = wrapvalue( camy + mousemovex() * 0.4 )
yrotate object 2, curveangle( camy, oldcamy, 24 )
` xrotate camera 0, curveangle( camx, oldcamx, 24 )
If UDKey <> 0
PHY Move Character Controller 2, UDKey * 200.0
Endif
If LRKey <> 0
YRotate Object 2, WrapValue( CamY + ( 90 + LRKey ) )
PHY Move Character Controller 2, LRKey * 100.0
YRotate Object 2, WrapValue( CamY )
endif
If Abs( MCKey ) <> 3
Set Cursor 0, 0 : Print MCKey
` XRotate Object 2, 90
` PHY Move Character Controller 2, MCKey * 200.0
` XRotate Object 2, 0
PHY Set Character Controller Displacement 2, 0, MCKey * 1000.0
PHY Move Character Controller 2, 0
Endif
` If LRKey = 0 And UDKey = 0 Then PHY Move Character Controller 2, 0
PHY Update
` Update the camera to go where the player is.
position camera object position x(2), object position y(2) + 20, object position z(2)
rotate camera object angle x(2), object angle y(2), object angle z(2)
Sync
Until SpaceKey() = 1
if I use :
LeftMouseClick + LeftKey : the player go up on Y axis (flying apparently)
RightMouseClick+ LeftKey : The player go down on Y axis (flying apparently)
If the player in in the sky and I sopt pressing Left/Right mouse click and left key, it remain in the sky. No gravity apply on it.
if I use displacement with ID+3 params (X#, Y#, Z#) I get no effect(even if I alter X, Y and Z). If I use displacement with ID+1 param, I also get no effecT.
All we have to decide is what to do with the time that is given to us.