Oscillator is working! \o/ But how to rotate?

Here’s my first moving obstacle! Not very much but really excited about it.
I also tried to make one rotate, creating a new script and trying to change some bits of it, but couldn’t make it work. I hope there’s something about it in further lessons of this course. Anyway, if someone could give me a hand on it, I’d be glad. :slight_smile:

Hi Samuel,

Create a new script and attached it to the transform. I combine it with the oscillator on the same transform. Change the xyz to something different you currently have on the transform. Good luck.

public class SwingRotate : MonoBehaviour
{
public float xAngle, yAngle, zAngle;

void Update()
{
    transform.Rotate(xAngle, yAngle, zAngle, Space.Self);
    transform.Rotate(xAngle, yAngle, zAngle, Space.World);
}

}

Privacy & Terms