Change relativeTo but keep position?


#1

Is it possible to change the relativeTo attribute but keep the position? For example, I have an object relative to Z.screenLeft, then I change it to Z.screen. I wish to keep the object at the same spot, but the position transform should be updated because now its relativeTo changed.

Or maybe, is it possible to retrieve an object’s position relative to someting other than what its currently relative to? So it’s relative to Z.screenLeft, if I do mynode.position() I will get the current position relative to Z.screenLeft, but is there a way to do something like mynode.position(relativeTo, Z.screen) to get it relative to the screen?

Or maybe, is there a way to get the absolute position of the objects on the screen? So if I have 2 objects, one at (0, 0, 0) but relative to Z.screenLeft, and the other is also at (0,0,0) but relative to Z.screen, and I want to calculate the distance between them. I can’t just subtract their positions because it will give me 0.


#2

I think what you’re looking for is in the Zapbox Xylophone demo. They track the controller and then fake where the model is using relativeTo and other data.

Xylophone project

Steve