Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Metaponta |
I’ve got a spacial node, with a camera as child of it
its Y rotation changes based on mouseMotion.x input when rightclick is pressed
var acceleration = 10
var hRotation
func _physics_process(delta):
if m2_down:
hRotation += -mouseMotion.x
rotation_degrees.y = lerp(rotation_degrees.y, hRotation, delta * acceleration)
Works perfectly
But now i need to transform the Node along its locals, when leftclick is pressed, based of mouseMotion aswell
if m1_down:
destination.x += mouseMotion.x
destination.z += mouseMotion.y
global_transform.origin = lerp(transform.origin, destination, acceleration * delta)
The code works untill the Node is rotated, its still moving on the global directions
I’ve found a solution online, using the move_and_slide() function wich is a KinematicBody node…
I really need the node to stay spacial and driven by the mouseMotion
Help pls :c