Jump to content
  • Advertisement
Sign in to follow this  

Quaternion rotation and -1.#ind

This topic is 4308 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, im rotating an object using quartionions and then converting back to angle axis. A prooblem arises when the object makes any full rotation on one axis it disapears for a frame and then comes back. So i traced scale when this disapearing occurs it has the value -1.#ind. I know this is the problem but i dont kow what this means or how to fix it. Thanks for nay help. here is my code
 float  scale = sqrt(1 - ( qm.mData[3] * qm.mData[3] ) );     //quaternion to axis to angle converion
      if (scale == 0 )
      scale = 1;
     cout <<"scale = " << scale <<endl;
   	   x  = (qm.mData[0] / scale);
       y  = ( qm.mData[1] / scale);
       z  =  (qm.mData[2] / scale);                         //quaternion to axis to angle converion

      float angleq; 
	  angleq = acos( qm.mData[3] ) * 2.0f;                 //quaternion to axis to angle converion
      angleq = gmtl::Math::rad2Deg(angleq);

Share this post

Link to post
Share on other sites
Well, run through it in the debugger and see where the value's coming from. My money's on you trying to find the square root of a negative number.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!