#Rotating a CharacterBody3D to the input direction

1 messages · Page 1 of 1 (latest)

unreal turret
#

rotate the input vector by the camera rotation

thorn needle
#

I don't have any WIP code for it yet

unreal turret
#

it'd be somewhat like this:

var desired_velocity: Vector3 = Vector3(Input.get_axis("move_left", "move_right"), 0, Input.get_axis("move_backwards", "move_forwards"))

desired_velocity = desired_velocity.rotated(Vector3.UP, camera_pivot.rotation.y)
#

you'd need to get some kind of reference to the twistpivot, but other than that, this code is the gist of it