How Do i Get the X,Y Position After Rotation
Ok the thing is that After i apply a set of Transformation and Concatenate them i was wondering how to get the new Position After the Object is Rotated. I try getting the _.41,._42,._43 of the Matrix but it keeps on giving me the same Thing which makes sense because all i am doing is Rotating but the problem is that with my bounding box i want to know what are the coordinates of the points that make the quad so i can reposition my bounding box around the mesh. This is For a 2D Game that i am making that uses Realtime Physics.
If I have understood your problem correctly, you should be able to get your positions by adding cos(rotation) to your x coordinate and sin(rotation) to your y coordinate.
Reading values straight out of the matrix does work in some cases, but for the most part it's just not going to work [smile]
D3DXVec2TransformCoord( ) is the function you'll be wanting. The raw maths behind matrix transforms isn't too difficult, so if you don't want to be using D3DX post back here and I'll see if I can dig out the actual formulae.
hth
Jack
D3DXVec2TransformCoord( ) is the function you'll be wanting. The raw maths behind matrix transforms isn't too difficult, so if you don't want to be using D3DX post back here and I'll see if I can dig out the actual formulae.
hth
Jack
// Rotate point POS (X: float, Y:float) by fAngle degreesvoid RotatePoint(POS* pPosition, double fAngle){ float iOldX = pPosition->X; double fCos = cos(fAngle * 0.01745329251988); double fSin = sin(fAngle * 0.01745329251988); pPosition->X = (float)( (fCos * (double)pPosition->X) - (fSin * (double)pPosition->Y) ); pPosition->Y = (float)( (fSin * (double)iOldX ) + (fCos * (double)pPosition->Y) );}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement