Quat.Delta
static Quat Delta(Quat from, Quat to)
Creates a quaternion that goes from one rotation to another.
Quat from | The origin rotation. |
Quat to | And the target rotation! |
RETURNS: Quat | The quaternion between from and to. |
static Quat Delta(Vec3 from, Vec3 to)
Creates a rotation that goes from one direction to another. Which is comes in handy when trying to roll something around with position data.
Vec3 from | The origin direction. |
Vec3 to | And the target direction! |
RETURNS: Quat | The quaternion between from and to. |
Examples
Pose spherePose = new Pose(-1, 0, 1, Quat.Identity);
Quat sphereDelta = Quat.Identity;
Vec3 oldPalmPos;
void SpinningSphere()
{
// Draw a sphere that you can spin around with your right hand!
Vec3 palmPos = Input.Hand(Handed.Right).palm.position - spherePose.position;
if (palmPos.Length < 0.3f)
{
sphereDelta = Quat.Delta(oldPalmPos.Normalized, palmPos.Normalized);
}
spherePose.orientation = sphereDelta * spherePose.orientation;
oldPalmPos = palmPos;
Mesh.Sphere.Draw(matDev, spherePose.ToMatrix(0.5f));
}
Found an issue with these docs, or have some additional questions? Create an Issue on Github!