Hi,
My character send bullets, and I would like that their rotation to be relative to their speed, to go in the right direction.
I can make them spawn with the right angle, but then, the rotation doesn't get update.
I used this :
I try to uncheck Fixed Angle, but it's not helping at all, anyone knows what to do? I've tried...
Rotation relative to speed.
My character send bullets, and I would like that their rotation to be relative to their speed, to go in the right direction.
I can make them spawn with the right angle, but then, the rotation doesn't get update.
I used this :
Code (JavaScript):
- function FixedUpdate(){
- angle = Mathf.Atan2(speed.x,speed.y)*Mathf.Rad2Deg;
- print(angle);
- rigidbody2D.rotation = (-angle);
- }
Rotation relative to speed.