Jump to content
  • Advertisement
Sign in to follow this  

help w/ arcball rotation control

This topic is 4865 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 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; } --- My problem in trying to debug this is that, I can see that each of the matrices are being populated with arcball coordinates, and my code seems to compare exactly with that of the examples in the nehe and other tutorials. 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!