Absolute direction Vector2D
Hi guys, I've been developing my game for around a week so far with no problems but I've ran into a problem today which I can't seem to get my head around. Basically my player has a skill where he throws a sword, so I spawn the sword and fire it to the right (which is forward in my game) but I try to apply rotation to the sword so that it looks like it is flipping through the air, unfortunately because the rotation changes, the sword starts flying backwards and upwards because its orientation is messed up.
My code is below:
swordRotation = 3f;
swordRotation -= Time.deltaTime;
transform.Translate(Vector2.right * 25f * Time.deltaTime);
transform.Rotate(0, 0, swordRotation);
I was wondering how do I make the sword fly in the direction the character is facing regardless of the swords rotation? By the way this code is on the sword itself, not the player.
Thanks.
Your answer
Follow this Question
Related Questions
Is there an int based class/struct like Vector2? 4 Answers
Unity Error Script Vector2 0 Answers