system
1
|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
AbDevTM |
I have a weapon and I want to make it rotate according to my touchscreen joystick. Like I want the weapon to rotate according to the joystick vector
system
2
|
|
|
|
Reply From: |
jgodfrey |
So, you just want to set the rotation
property of the weapon to the angle of your joystick? If so, something like this should work:
_process(delta):
$Weapon.rotation = joystick_vector.angle()
Obviously, you’ll need to update the $Weapon
node reference and the name of the variable holding your joystick vector…
Thanks, it works perfectly!
AbDevTM | 2023-01-02 08:50