- Home /
Question by
$$anonymous$$ · Nov 29, 2014 at 08:07 PM ·
rotationquaternionsphereverticesfromtorotation
Rotate a sphere by its vertices...
Hi, I need to rotate a sphere so that the pink vertex moves to the north pole where the blue vertex is. The whole sphere needs to rotate. I figure something like Quaternion.FromToRotation but I'm not sure how.
I know the Vector3 of the pink vertex, the Vector3 of the blue vertex and the Vector3 of the center of the sphere. How do I perform this rotation?
My code:
Vector3 pink_dot_location = ver[0];
Vector3 blue_dot_location = ver[1];
sphere.rotation = Quaternion.???????
rotatesphere.jpg
(88.3 kB)
Comment
Best Answer
Answer by robertbu · Nov 29, 2014 at 08:09 PM
Vector3 pink_dot = ver[0] - center;
Vector3 blue_dot = ver[1] - center;
sphere.rotation = Quaternion.FromToRotation(pink_dot, blue_dot) * sphere.rotation;
Your answer
Follow this Question
Related Questions
Rotation, my script shouldn't work but does. 0 Answers
Rotation problem 1 Answer
Doing 2D only rotation using FromToRotation + RotateTowards 0 Answers
"Free" rotation about a sphere 0 Answers
Lerp rotation relative to sphere 0 Answers