Hello fellow Unity users! I’ve come back to Unity answers to ask for help with something that I can’t seem to get working. I’m trying to rotate my Player in-game when he goes down a slope or up one. I used to be able to do this with ease using Player.transform.rotation = Quaternion.Euler(0, 0, Rotation); however ever since I’ve began to create my animations in engine using the record button in the animation window, I can no longer rotate in-game.
Every time I try and rotate it quickly goes back to it’s original rotation. I can rotate the player when the game is not playing(so when the animation is not playing) and he’ll stay in the rotation through the whole level, but when I try to do it while playing it doesn’t work. I hope I’m making some sense here.
My Unity version is kinda old (it’s 4.3.4), so maybe it’s easier in the newer versions. However I can’t upgrade at all since I’m in development and it always ruins my game’s controls and many other things.
So how can I rotate in-game? Is it possible in my old version of Unity? Can I rotate while ignoring animations? I need help!
Here’s my script:
public float Rotation;
public GameObject Player;
void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Player") {
Player.transform.rotation = Quaternion.Euler(0, 0, Rotation);
}
}
}