Page 1 of 1

Assistance request: Calcuting LocalToParent Matrix

PostPosted: Mon Dec 10, 2007 1:51 pm
by Trylon
Hi,
instead of spending several hours trying to figure it out myself, while I should rewrite the resource manager, I'll just ask for a little help here.

My problem:

I need to compute a LocalToParent (and ParentToLocal) transformation matrix, in order to allow parenting of dynamic objects.
My input: the LocalToWorld matrix of the Parent and the LocalToWorld matrix of the Child.

I thought a matrix substraction would de the trick, but I'm not to sure of that, so any advice is welcome...

Thanks!

Re: Assistance request: Calcuting LocalToParent Matrix

PostPosted: Mon Dec 10, 2007 3:35 pm
by Nadnerb
I'm assuming you want to parent an object, without changing it's position. (ie make object a parent to object b, while retaining the world position of b)

You need to divide, or more accurately, multiply by the inverse, to get rid of the transformation from world to local of the child.

ChildParentToLocal = ChildWorldToLocal * ParentWorldToLocal.getInverse()

I don't have anything to test on currently, and I'm not even sure if you can multiply ptMatrix44 objects, but I think this is on the right track.

Uhm, out of curiosity, are you working on subworlds? :?

Re: Assistance request: Calcuting LocalToParent Matrix

PostPosted: Mon Dec 10, 2007 11:36 pm
by Trylon
No, this is for the Coordinate interface