Set Rotation of GameObject
Hi! I have a really quick question that I hope has a really easy fix. So I'm trying to set the rotation of the gameobject that the script is on to a specific number whenever a condition applies (in the update), but what ends up happening is that my object continues to rotate around in increments of my set number.
if (XValue == 1)
{
transform.Rotatearound(Player.transform.position, Vector3.forward, 90);
}
When XValue = 1, I want it to rotate to the rotation 90 (pivoted around the player which I already have)
Answer by xxmariofer · Jan 29, 2021 at 10:34 AM
Then simply set XValue back to 0, because it is calling that same line over and over
Your answer
![](https://koobas.hobune.stream/wayback/20220613024154im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
game object not rotating on its pivot 1 Answer
Attach gameobject to multiple gameobjects 1 Answer
Object transform rotation around correct pivot, but wrong pivot after colliding 0 Answers
Turret rotation towards a Widget,Making a Game Object rotate towards a widget 0 Answers
World Rotation Around The Player Lead me to a Strange Result! 0 Answers