Trying to rotate

I’m trying something a little different. Instead of moving an obsticale along an axis, I’m trying to rotate one, but I’m getting stuck in the code.

It’s not as simple as changing ‘transform.position’ to ‘transform.rotation’.

Here’s what I’m trying to achieve:

to

and back with the slider.

It looks like it has something to do with with Quaternions, but I can’t wrap my head around it.

2 Likes

Yeah, in Unity they store rotation in eulerangles to make it easier then trying to use Quaternions, try using transform.eulerAngles.z to rotate your object along the z axis.

Thank you for the tip.

I sort of got it to work using transform.eulerAngles, but I haven’t yet figured out how to control it using the Movement Factor slider, let alone limit the range of rotation.

I’m going to let it go for now, so I can keep progressing through the course and return back to it when I gain more experience.

1 Like

Privacy & Terms