Jump to content
  • Advertisement
Sign in to follow this  

arcball rotation control problem

This topic is 4614 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

I'm looking for any possible way that might help me debug an arcball rotation control problem. I've compared my code with the nehe tutorial and other java examples, but still can't find what could be wrong. My problem is that the accumulation of the rotations isn't happening because the model keeps snapping back to the origin each time I click on it, and rather than accumulating the last rotation w/ the current rotation, it just starts over from the origin. --- in sum ... ... public Quat4f quat = null; public Matrix3f lastRot = new Matrix3f(); public Matrix3f thisRot = new Matrix3f(); public Matrix4f transform = new Matrix4f(); ... public void mousePressed(MouseEvent me) { // Here we set the last static rotation to the last // dynamic rotation. arcBall.lastRot.set(arcBall.thisRot); // Update start vector and prepare for dragging. arcBall.click(me.getPoint()); } public void mouseDragged(MouseEvent me) { // Update end vector and get rotation as a quaternion. arcBall.drag(me.getPoint(), arcBall.quat); // Convert quaternion into matrix3f. arcBall.matrix3fSetRotationFromQuat4f(arcBall.thisRot, arcBall.quat); // Accumulate last rotation into this one. arcBall.matrix3fMulMatrix3f(arcBall.thisRot, arcBall.lastRot); // Set our final transform's rotation from this one. arcBall.matrix4fSetRotationFromMatrix3f(arcBall.transform, arcBall.thisRot); glDrawable.display(); return; } public void mouseReleased(MouseEvent me) { // Here we set the last static rotation to the last // dynamic rotation. arcBall.lastRot.set(arcBall.thisRot); return; } --- I can see that each of the matrices are being populated with arcball coordinates. I just don't understand why it keeps snapping back. I've been over this for days and can't figure out what's going on. Anyone have an idea/comments/advice on what I should be looking for, or can try to see why this is happening?

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!