Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8286321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:42:29+00:00 2026-06-08T11:42:29+00:00

I am trying to implement skeletal animation into my game engine and I have

  • 0

I am trying to implement skeletal animation into my game engine and I have a problem with the interpolation.

Each frame, I want to interpolate between frames and thus I have code similar to this:

// This is the soon-to-be-interpolated joint
Joint &finalJoint = finalSkeleton.joints[i];

// These are our existing joints
const Joint &joint0 = skeleton0.joints[i];
const Joint &joint1 = skeleton1.joints[i];

// Interpolate
finalJoint.position = glm::lerp(joint0.position, joint1.position, interpolate);
finalJoint.orientation = glm::mix(joint0.orientation, joint1.orientation, interpolate);

The final line is the problem. The orientation of finalJoint will sometimes be (-1.#IND, -1.#IND, -1.#IND, -1.#IND).

These are some example values and what they result in (note that interpolation is 0.4 in all three cases):

  • joint0.orientation = (0.707107, 0.000242, 0.707107, 0.0)
    joint1.orientation = (0.707107, 0.000242, 0.707107, 0.0)
    finalJoint = (-1.#IND, -1.#IND, -1.#IND, -1.#IND) (Incorrect)

  • joint0.orientation = (-0.451596, -0.61858, -0.262811, -0.586814)
    joint1.orientation = (-0.451596, -0.61858, -0.262811, -0.586814)
    finalJoint = (-0.451596, -0.61858, -0.262811, -0.586814) (Correct)

  • joint0.orientation = (0.449636, 0.6195, 0.26294, 0.58729)
    joint1.orientation = (0.449636, 0.6195, 0.26294, 0.58729)
    finalJoint = (-1.#IND, -1.#IND, -1.#IND, -1.#IND) (Incorrect)

(Yes, I am aware that it’s interpolating between the same values.)

I have not yet grasped exactly how quaternions work, but this just seems strange to me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:42:34+00:00Added an answer on June 8, 2026 at 11:42 am

    If you look at the typical Slerp equation, you’ll see that it has a Sin(Ω) in the denominator of a fraction where Ω is the angle between the two quaternions: i.e., Ω = acos(dot_product(q1,q1)); Now, Sin(0)==0; And when you divide by zero, there are problems. As mentioned in the Wikipedia article, this is a removable discontinuity, but that takes a bit of extra checking.

    I just pulled down the code to take a look. Here’s the sum of it:

    T angle = acos(dot(x, y));
    return (glm::sin((T(1)-a)*angle)*x+glm::sin(a*angle)*y)/glm::sin(angle);
    

    No special checks. This is prone to have numeric problems as the angle approaches zero. It may also take the long way around the rotation sphere for some interpolations. There are two other versions of glm:::mix commented out that do a better job dealing with these problems. It looks like the current version and its accompanying problems were committed to the repository in May of 2011.

    I would recommend reverting to the version that uses linear interpolation if the angle is less than some threshold amount. Just comment out the current and uncomment the old one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to implement a timer for my game that I'm making. I have a
I trying to implement the url template tag into my project. I have a
Trying to implement page turning animation exactly as the flipboard ipad app. I have
I am trying implement a most recent widget into my tumblr post. So far,
Trying to implement 3-layer (not: tier, I just want to separate my project logically,
I am trying implement Unblock me Puzzle. i want to change image position from
Trying to implement NSCopying for the first time, and I have a question about
I have this weird kind of error. I am trying implement basic Euclidean algorithm
Trying to implement what I thought was a simple concept. I have a user
Trying to implement frames wherein clicking on a link in left frame should open

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.