Assistance request: Calcuting LocalToParent Matrix

Moderators: Trylon, Paradox

Assistance request: Calcuting LocalToParent Matrix

Postby Trylon » Mon Dec 10, 2007 1:51 pm

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!
One day I ran through the cleft for the fiftieth time, and found that uru held no peace for me anymore.
User avatar
Trylon
 
Posts: 1446
Joined: Fri Sep 28, 2007 11:08 pm
Location: Gone from Uru

Re: Assistance request: Calcuting LocalToParent Matrix

Postby Nadnerb » Mon Dec 10, 2007 3:35 pm

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? :?
Live KI: 34914 MOULa KI: 23247 Gehn KI: 11588 Available Ages: TunnelDemo3, BoxAge, Odema
Nadnerb
 
Posts: 1057
Joined: Fri Sep 28, 2007 8:01 pm
Location: US (Eastern Time)

Re: Assistance request: Calcuting LocalToParent Matrix

Postby Trylon » Mon Dec 10, 2007 11:36 pm

No, this is for the Coordinate interface
One day I ran through the cleft for the fiftieth time, and found that uru held no peace for me anymore.
User avatar
Trylon
 
Posts: 1446
Joined: Fri Sep 28, 2007 11:08 pm
Location: Gone from Uru


Return to Scripting Journal

Who is online

Users browsing this forum: No registered users and 1 guest