I'm trying to learn how to use simple character controllers and rigid bodies... but for some reason the character just falls through the box...
Here is the code:
` set up general properties
sync on
sync rate 60
autocam off
phy start
set camera range 0.5, 30000
hide mouse
homebase()
` create our box controller
make object box 3, 20, 50, 20
phy make box character controller 3, 0, 20, 0, 10, 35, 10, 1, 10.5, 45.0
hide object 3
` our main loop
do
` 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 )
yrotate object 3, curveangle ( CameraAngleY#, OldCamAngleY#, 24 )
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
Function HomeBase()
Make object box 4,50,5,50
position object 4,0,0,0
color object 4,rgb(255,0,125)
phy make rigid body static mesh 4
EndFunction
I took out a lot of aesthetic stuff like skyboxes and the menu... just to make it easier for you to try to help me