So I have a roguelike player that can look in 4 directions and I have the gun flippiing when it hits 90 degrees and vice versa, but I want the gun to flip to the other side of the player as if it is going from his left hand to right hand. I tried using localPosition but it does seems to create 2 different players and guns and glitch out. Here is my code below that I have tried using. Any help would be appreciated!
//Flip weapon after certain angle
Vector3 aimLocalScale = Vector3.one;
Vector3 aimPositionScale = Vector3.one;
if (angle >= 90 || angle < -90)
{
aimLocalScale.y = -1f;
aimPositionScale.x = -1f;
}
else
{
aimLocalScale.y = +1f;
aimPositionScale.x = +1f;
}
aimTransform.localScale = aimLocalScale;
aimTransform.localPosition = aimPositionScale;
↧