I have this code but the camera wont switch behind the player(box) when for instance you move it towards the screen, any ideas how to make it happen? also how would i make the character jump when it is using physics char controller ?!
phy start
autocam off
set window off
sync on
sync rate 60
color backdrop 0
make light 1
set directional light 1, -5, -5, 5
`load object "room.x",1
make object box 1,2150,25,2150
phy make rigid body static mesh 1
make object box 2,5,5,5
color object 2,rgb(255,0,0)
phy make box character controller 2, 0, 20, 0, 2.5, 2.5, 2.5, 1, 1.5, 45.0
global Camdist# = 135.0
global TrackAngle = 0: Rem 0 - Behind, 180 - Front, 90 & 270 - Sides
global ReqCamHeight# = 5.0
global Camsmooth = 70
global ColFlag = 0
global char_speed#=100.0
global ObjHeight#=5.0
do
cam_control()
if leftkey ( )
turn object left 2, 3.0
endif
if rightkey ( )
turn object right 2, 3.0
endif
if upkey ( )
phy move character controller 2, char_speed#
else
phy move character controller 2, 0.0
endif
phy update
sync
loop
function cam_control()
ObjX# = Object Position X(2): ObjZ# = Object Position Z(2)
Camheight# = ObjHeight#+ReqCamHeight#
Set Camera To Follow ObjX#,ObjHeight#,ObjZ#,WrapValue(Object Angle Y(2)+TrackAngle),Camdist#,Camheight#,Camsmooth,ColFlag
Endfunction
Hail to the king, baby!