Skip to main content
gamedev.net
🔒 Locked

Matrix Math Question

Started by Maverick_24 Apr 11, 2009 at 4:49 PM 1 replies 550+ views
Original Post
Maverick_24
Maverick_24
This might be awkward for me to try and explain...I have a collection of 3d objects that all rotate in 3d space together. Independent objects can get attached to that collection. Once they get attached I need a way to "ignore" current 3d orientation of the collection and only apply rotations that happened after the object got "attached". I am thinking the answer might be something like this: foreach attached object: { * apply the global matrix * subtract the matrix that existed at the time the object was attached to the collection * draw the 3d object } How do you do this? Inverse of the matrix or something. Thanks, If I need to explain this further, let me know.
Maverick_24
Maverick_24
oops, I think this would belong more in the math section rather than opengl.
Zakwayda
Zakwayda
It sounds to me as if you want to add an existing object (with its own world transform) as a child in an existing hierarchy of objects - is that correct? The problem would then be to convert the object's world transform into a local transform that, when concatenated with its parent, will yield the same world transform (and therefore the same apparent position and orientation) that it had before.

If that is what you're trying to, then yes, matrix inversion is what you're after. You should be able to compute the new transform for the object as follows:
L = P<sup>-1</sup>Wwhere:L is the new local transform for the objectP is the parent object's world transformW is the original world transform for the object

Topic Locked

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

Sign in to reply to this topic.