0

i would like to aplly a reverse transformation matrix in a point. What is it for?: My app (game) apply transformation into several squares objects, each one has its own transformation matrix that are applyied when drawing it.

But i need to know if the mouse are over each object. so , for each object, I get the mouse position, and try to apply all transformations reversed. to revert the square and the mouseposition to its origin.

If im right, this way i can compare the transformed mouse position with the object bouds.

thw question is.. :how can i apply this reverse transformations ? i tried the inverse matrix, but it dosent exists all the time...

0

2 Answers 2

2

If there is no inverse for a transformation matrix (highly unlikely for most common transformations), then there is no way to undo the transformation. That's what having no inverse means: that the transformation is one-way.

Also, the way this is generally done is not by transforming mouse coordinates into world-space, but by transforming objects (or bounding-boxes thereof) into window space.

1

You might want to try gluUnProject().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.