Question by
Swabbie89 · Jan 25, 2021 at 08:40 PM ·
2d gameshooting2d rotation
How do I adjust the direction of my game object in the direction my player turns?
I'm trying to turn the fire point 180 degrees whenever my player is facing left and 0 degrees on the y when he is facing right. So far this is what I have in the player controller script. Any help would be greatly appreciated.
//point the firePoint in the correct direction
if (AstroBoy.instance.transform.position.x == 4f)
{
firePoint.localRotation = Quaternion.Euler(0f, 180f, 0f);
}
else
{
firePoint.localRotation = Quaternion.Euler(0f, 0f, 0f);
}
Comment
You can't check if == with a floa
if (AstroBoy.instance.transform.position.x == 4f)
{
Your answer
Follow this Question
Related Questions
2d shooting,Shooting bullets 2d 0 Answers
2D Gun following rotation problem 0 Answers
How could I do pixel art with no blurring rotation like in Tiny Survivor? 0 Answers
Set Maximum Z Rotation On 2D Player Object? 0 Answers
Linear speed in one direction 0 Answers