I'm having problems with the character controller, one being it doesn't seem to be where I'm telling it to be. I've set it up to make a cube and make a box controller around that cube, however it seems to be underneath that cube rather than around it, also, as it is in the post below, it works fine when moving the character controller, however, as soon as I uncomment "_PLAYER_Y# = object position y(_PLAYER_OBJECT)" it no longer moves backwards or forwards, and instead moves up and down. On top of all this, there seems to be no gravity on the character controller.
Hopefully I'm doing something wrong rather than it being an issue with DarkBasic, so any help would be much appreciated.
//Set Variables
_CAMERA_ORBIT#=-20.0
_PLAYER_OBJECT=2
_PLAYER_SPEED#=100.0
_PLAYER_DIRECTION#=0
_PLAYER_X# = 0
_PLAYER_Y# = 0
_PLAYER_Z# = 0
// FlashLogo()
phy start
make object plane 1, 400,400 : rotate object 1, 90, 0, 0 : phy make rigid body static mesh 1
make object box _PLAYER_OBJECT, 4, 4, 4 : position object _PLAYER_OBJECT, 0, 4, 0
phy make box character controller _PLAYER_OBJECT, 0, 4, 0, 4, 4, 4, 1, 1, 1
DO
_PLAYER_X# = object position x(_PLAYER_OBJECT)
// _PLAYER_Y# = object position y(_PLAYER_OBJECT)
_PLAYER_Z# = object position Z(_PLAYER_OBJECT)
Inputs()
PositionCamera()
if upkey() then phy move character controller _PLAYER_OBJECT, _PLAYER_SPEED#
if downkey() then phy move character controller _PLAYER_OBJECT, -_PLAYER_SPEED#
phy update
sync
LOOP
FUNCTION PositionCamera()
position camera _PLAYER_X#, _PLAYER_Y#, _PLAYER_Z#
if _MOUSE_BUTTON = 2
inc _CAMERA_X_ROT#, _MOUSE_MOVE_Y
inc _CAMERA_Y_ROT#, _MOUSE_MOVE_X
if _CAMERA_X_ROT# > 75 then _CAMERA_X_ROT# = 75
if _CAMERA_X_ROT# < 5 then _CAMERA_X_ROT# = 5
rotate camera _CAMERA_X_ROT#, _CAMERA_Y_ROT#, _CAMERA_Z_ROT#
endif
inc _CAMERA_ORBIT#, (_MOUSE_MOVE_Z/100)
if _CAMERA_ORBIT#<-20 then _CAMERA_ORBIT#=-20
if _CAMERA_ORBIT#>-5 then _CAMERA_ORBIT#=-5
move camera _CAMERA_ORBIT#
ENDFUNCTION
FUNCTION Inputs()
_MOUSE_BUTTON = mouseclick()
_MOUSE_MOVE_X = MOUSEMOVEX()
_MOUSE_MOVE_Y = MOUSEMOVEY()
_MOUSE_MOVE_Z = MOUSEMOVEZ()
_KEY_PRESS = scancode()
ENDFUNCTION