I'm trying to get the character controller to move in the direction of my joystick, but it moves in one direction forever. Here's my code, there are no assets so it should be easy to test in an empty project:
SetWindowTitle("3D Character")
Create3DPhysicsWorld()
player = CreateObjectCapsule(40, 72, 1)
SetObjectPosition(player, 0, 200, 0)
zerovec = CreateVector3()
Create3DPhysicsCharacterController(player, 1, zerovec, zerovec, 0.5)
ground = CreateObjectPlane(400, 400)
SetObjectRotation(ground, 90, 0, 0)
Create3DPhysicsStaticPlane(0, 1, 0, 0)
SetCameraPosition(1, 0, 200, -400)
FixCameraToObject(1, player)
movespeed = 40
do
if GetRawKeyPressed(27) then end
posx# = GetObjectWorldX(player)
posz# = GetObjectWorldZ(player)
Print(posx#)
Print(posz#)
if GetButtonPressed(1)
Jump3DPhysicsCharacterController(player)
endif
Move3DPhysicsCharacterController(player, posx# + GetJoystickX(), posz# + GetJoystickY(), movespeed)
Step3DPhysicsWorld()
Sync()
loop
Is there anything I'm doing wrong here?