Getting object positions relative to another object's local space?
UPDATE =================================
Thanks to Insanto and Anubis I have found two ways to do what I needed below!
1. theCoords = ($Box01.transform * (inverse $Plane01.transform)).pos
2. theCoords = in coordsys $Plane01 $Box01.pos
========================================
Hello, I'm having trouble getting object's positions relative to another object's rotation & position (transform). See example below:
I'm trying to get the coordinates of this box relative to this plane's local coordinates. The XYZ coords it should return in this case would be (0,-20,-25).
I have tried
in coordsys $Plane01 $Box01
but it returns the value of the Box's coordinates in world space.. something like (0, 3.536, 46.481)
I've managed to move the box in Plane01's world space using in coordsys $Plane01 move $Box01 [0,0,1] which is a tease but this is not what I need. Did I miss something here? I've looked all over in the documentation. I've included the example scene. Thanks for any help!
Comments
(b.transform * (inverse
(b.transform * (inverse p.transform)).pos
Raphael Steves
Brilliant!! I think this
Brilliant!! I think this method provides great insight as to how the position is calculated. Thank you so much!
- Dru
I dont see scene attached but
I dont see scene attached but with the next code I hope you will see what you miss ;)
my recent MAXScripts RSS (archive here)
Awesome, Thank YOU!!! Looks
Awesome, Thank YOU!!! Looks like I missed ".pos" when doing my tests(doh!). I knew this forum and members like you would help me see the light!. Thank you!
- Dru
I've created this hack, but I
I've created this hack, but I think it's a bit sloppy. There has to be a better way..
fn translatePosition theObject theTargetObject =
(
local helperDummy = dummy()
helperDummy.transform = theObject.transform
local lc = link_constraint()
helperDummy.controller = lc
lc.addTarget theTargetObject 1
local thePos = helperDummy.pos
delete helperDummy
return thePos
)
myPos = translatePosition $Box01 $Plane01
- Dru