I have a node which fires a bullet, but I want to randomly rotate it a little so that certain guns are unpredictable. Specifically, I want to rotate it on the X and Y axes between a -2.5 - 2.5 degree arc on the local axis. I've tried rotation.x = rand_range(-2.5, 2.5 * PI)
and rotation.y = rand_range(-2.5, 2.5 * PI)
, but these seem to rotate the node on the global X and Y axes. How should I rotate the bullet emitter node locally between an arc? Thank you in advance.
Asked
Active
Viewed 275 times
0

benman
- 137
- 1
- 11
-
Does this answer your question? [How to LERP between 2 angles going the longest route or path in Godot](https://stackoverflow.com/questions/68875814/how-to-lerp-between-2-angles-going-the-longest-route-or-path-in-godot) – Theraot Oct 24 '21 at 21:28
1 Answers
0
Step 1: Spawn your bullet
Step 2: Give it the rotation of the parent object
Step 3: To that rotation add you random rotation
Step 4: Shoot

ydinkov
- 61
- 2