Hi,<br /><br />I'm working on a player controller similar to the one used in the game "Alien Shooter".<br />I got the movement working quite well but I can't figure out how to get the rotation right, so that the character is facing towards the mouse.<br />This is the closest I could get so far:<br />
<br />onready var body = get_node(&quot;body&quot;)<br /><br />func _ready():<br /> set_process_input(true)<br /><br />func
input(ie):<br /> if ie.type == InputEvent.MOUSE_MOTION:<br /> if last_position == null:<br /> last_position = ie.pos<br /> var delta = ie.pos - last_position<br /> last_position = ie.pos<br /> body.rotate_y(-delta.x * 0.01)<br />
<br /><br />My node tree looks like:<br />
<br />- KinematicBody<br />&nbsp; - Camera<br />&nbsp; - Body<br />
<br />The script is attached to KinematicBody.<br /><br />I read a lot about vectors and trigonometry and tried to adapt a third-person-controller-demo, but I just don't get it right. <img alt="" height="20"><br /><br />Hope someone can give me a nudge in the right direction!?