- Home /
How to "spin" a ring, but not rotate it?
Hi folks. Newbie stuck in Quaternion land at the moment. The base mechanic I'm trying to implement is flying through a ring in a rail-shooter environment, a la Star Fox 64. I'm stuck on a particular piece of visual flair - getting the rings to spin on an axis instead of rotate around x, y, z angles.
For a visual, I'm trying to replicate the behavior seen on the yellow and blue rings from the Training Level. The hole the plane flies through remains fixed, but the ring spins in place.
The problem I have is that every time I try to modify the rotation, I end up rotating the ring in place around the roll, pitch or yaw - not spinning it around a center point. I've stumbled through some of the Quaternion methods, but can't seem to find one that suits my needs.
Has anyone else solved this problem or could point me to a resource that would help? You suggestions are greatly appreciated!
I understand you need center a pivot on these objects. So you can achieve this with 2 ways:
Prepare good pivoted ring objects.
Create transform parent and pivot it manually by positioning it inside the parent transform. Then rotate a parent transforms ins$$anonymous$$d ring object.
Answer by tanoshimi · Jun 30, 2017 at 06:58 AM
Tip: You hardly ever need to directly manipulate quaternions - do everything in Euler angles which are simply to manipulate and visualise.
The example you've shown is a simple rotation around the z axis, with a pivot in the centre of the ring model. If that's not the result you're getting, it may be helpful if you post a video of what's going wrong.
Agreed on the direct manipulation of quaternions... I found that one out the hard way. The Euler angle manipulation is what I was getting stuck on.
At your suggestion, I made a quick video of what I was experiencing - and @$$anonymous$$asterio 's comment of "prepare good pivoted ring objects" sparked the thought to try the built in rotational tool. (Don't know why I didn't try that from the start).
So the good news is that I had the pivot in the center already, and the bad news was that I didn't have the initial angles set properly to make the simple rotation along one axes. Rotational tool fixed the orientation for me (y from 0 to -90, z from 180 -> 270) and aligned the model with a single axis that I should now be able to change via scripting.
Thank you for your help!
Your answer
Follow this Question
Related Questions
How to set a limit for my player rotation ? 0 Answers
Finding A Rigidbody's Rotation Speed And Direction 2 Answers
Player character X rotation going haywire on game start 1 Answer
Rotating Rigidbodies 2 Answers