Hello,

I'm feeling pretty defeated at this point and figured I need to ask for some 
help. I feel like what I'm trying to do should be very easy and that I'm just 
making it too difficult. What I'm trying to do is translate and scale a quad 
about an anchor point. I've managed to get the initial logic working very well 
for setting the anchor point and scaling around it. I can also translate just 
fine before or after the first scale. The issue I'm having is when I go to 
scale a second time around a different anchor point. I can't seem to be able to 
figure out the proper logic to do this. Here's how I'm computing the quad's 
matrix for anchored scaling then translation.


Code:

osg::Matrix matrix;

// 1) Move the matrix to the anchor point
matrix *= osg::Matrix::translate(-_anchorPoint);

// 2) Multiply the scale matrix at the anchor point
matrix *= _scaleMatrix;

// 3) Move the matrix back to the origin
matrix *= osg::Matrix::translate(_anchorPoint);

// 4) Multiply the translation matrix
matrix *= _translationMatrix;

// 5) Apply the new matrix to the quad
setMatrix(matrix);




Initially my translation matrix is zero and my scale matrix is set to 1.0 in 
all directions. This all works great during the first scaling operation. The 
problem is that once I stop scaling, then change my anchor point, the quad 
jumps. I'm assuming this is because I'm changing the anchor point and nothing 
else. I've tried everything from decomposing the current matrix and resetting 
the anchor point back to 0.0, 0.0 but I can't seem to figure it out. Any help 
would be greatly appreciated.

Thanks!
--

Christian

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=56199#56199





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to