if Input.is_action_just_pressed("jump"):
if is_on_floor():
capncrunch.y = jump_height
if not is_on_floor():
capncrunch.y -= gravity * delta
move_and_slide(capncrunch, Vector3.UP)
Use global_transform.basis.xform(Vector3) to get a local vector.
move_and_slide(global_transform.basis.xform(capncrunch), Vector3.UP)
#or for a third person camera
move_and_slide(Camera.global_transform.basis.xform(capncrunch), Vector3.UP)
it didn’t work just when i pressed a button to move forward it would just move north not actually where the character is facing
James122333 | 2020-11-19 18:22
Is the camera a child rotating in the kinematicbody parent? You need to reference the node want to move relative to.
Magso | 2020-11-19 18:25
Yes it is but ive been stuck on this problem for hours
if Input.is_action_pressed("move_forward"):
direction += transform.basis.z
elif Input.is_action_pressed("move_backward"):
direction -= transform.basis.z
if Input.is_action_pressed("move_left"):
direction += transform.basis.x
elif Input.is_action_pressed("move_right"):
direction -= transform.basis.x
Then I use the move_and_slide() function with direction(which is a vector3). Out of total curiosity why do you have a variable called capncrunch? =)
thank you so much!!! i retried it and it worked
James122333 | 2020-11-19 22:08
glad to hear it! I’m still curious as to why you named your variable after a breakfast cereal though, =D