Relative coordinate spaces
by Phil Shenk · in Torque Game Builder · 07/11/2005 (10:07 pm) · 4 replies
I've been thinking about ways to move one object in the coordinate space of another. Say, for example, I've got a tile layer that is rotating, or that can rotate. Imagine a floating island or a ship from top-down. Now, say I've got a sprite character that I want to sit on that ship, and walk around. As the ship rotates and moves, the char should also rotate and move. Additionally, I'd like to be able to specify position in relation to the "parent" object. Like setPosition("4 3") would place it just like adding a linkPoint or a mount, in relation to the object's local space.
Being able to move mount points would do it. I guess what I'm looking for is a matrix transform maybe?
Being able to move mount points would do it. I guess what I'm looking for is a matrix transform maybe?
About the author
#2
07/12/2005 (9:32 pm)
Right, that's easy. But then how do you move the player back and forth, and all over the deck of the ship as it itself moves and rotates around the world? You can't move mounts or linkpoints after they are set up.
#3
07/13/2005 (2:35 pm)
But you can specify the offset for a node. I haven't tried it, but you should be able to just unlink it and change the offset and then relink it.
#4
07/14/2005 (8:49 am)
Yeah, that could work. It might not be the most lightweight of operations, but it's worth a shot. I think there is some more flexible mounting functionality coming in the future. Maybe changing an offset without recreating a mount will be on the plate.
Torque Owner James Johnson
You could also do it with matrices, but I think that would make things more complicated than it needs to be.