Jump to content

Help with quaternion multiplication


Recommended Posts

I have finally managed to convert absolute quaternions to navball quaternions like this:

public Quaternion ReferenceToWorld(Quaternion localRotation, FrameOfReference reference)
{
switch (reference)
{
case FrameOfReference.Navball:
return (OrbitalOrientation * localRotation) * Quaternion.Euler(90, 0, 0);
default:
return Quaternion.identity;
}
}
public Quaternion WorldToReference(Quaternion worldRotation, FrameOfReference reference)
{
switch (reference)
{
case FrameOfReference.Navball:
return (Quaternion.Inverse(OrbitalOrientation) * worldRotation) * Quaternion.Inverse(Quaternion.Euler(90, 0, 0));
default:
return Quaternion.identity;
}
}

Now I would like to do the same conversion with vector3s. The problem I have is, I can't apply the Quaternion.Euler(90, 0, 0) last, because you can not multiplay Vector3 * Quaternion. How would I have to rearrange this in order to keep the result but have the local/world rotation last in the multiplication order ?

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...