Skip to main content
GameDev.net gamedev.net
🔒 Locked

D3DXSprite position

Started by JariRG Feb 25, 2011 at 11:47 PM 1 replies 1k views
Original Post
JariRG
JariRG
Im trying to get the position (_41, _42) from the constructed matrix (D3DXMatrixTransformation2D). The main problem is, when rotation is not 0, the position from matrix is rotated too. The rotation center is set to half size of texture (rectangle), and it doesn't seems to rotate position around this RotationCenter point. If the rotation value is 0, then the position vector from matrix is exactly what it should be.
It's a hierarchical system, so i cant just use the Position what set by the user, i must reconstruct after D3DXSprite's SetTransform call.

Why rotates the Position? Or how can i restore the correct position value?

EDIT: I forgot to mention, the sprite is rendered the correct position to the screen!
JariRG
JariRG
I did a video to better show my problem:

You can see the gear sprites: rendered to the good position, but the bounding rectangle is rotated.
The bounding rectangles top/left are calculated:


...
_dxSprite->SetTransform(matTransform);
...
_onScreenRect.left = matTransform->_41;
_onScreenRect.top = matTransform->_42;


The ship is rendered this way too, but no rotation set (the value is 0), and the bounding rect's positions are ok.

Ideas?


Thanks.
JariRG
JariRG
Bump.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.