2 questions: interpolate groups, and absolute position

Hi,

I am trying to figure out if the following is possible:

I have 2 groups

G1:

  • G1LeftArm
  • G1Torso
  • G1RightArm

AND

G2:

  • G2Body
  • G2Arm

Is it possible to render the objects in the following order?

  • G1LeftArm
  • G1Torso
  • G2Body
  • G1RightArm
  • G2Arm

If this is not possible, I have another question:
Is it possible to get the absolute position and rotation of G1RightArm? By absolute position, i mean the values it would have in the parent group (self.view) to be at the exact same spot and rotation?
[import]uid: 127214 topic_id: 27058 reply_id: 327058[/import]

I guess the only way to sort “z-depth” after object creation is this:

object:toFront( )  
Moves the target object to the visual front of its parent group (object.parent).  

http://developer.anscamobile.com/reference/index/objecttofront

but this works inside a group only. I don’t think there is a way to “split” up your group G2 to render it’s contents in the order you described, i.e. to mix groups.

-finefin
[import]uid: 70635 topic_id: 27058 reply_id: 109846[/import]

Than question 2 applies: Is there at least a way of getting values relative to parent groups? this way I could keep the body parts in separate groups, and still have them move as they should. [import]uid: 127214 topic_id: 27058 reply_id: 109849[/import]

You maybe want to look at contentToLocal() and localToContent() functions.
For exampe:

--for obj1 that is in group1  
local screenX, screenY = group1:localToContent( obj1.x, obj1.y )  
  
local relativeToGroup2 = group2:contentToLocal( screenX, screenY )  

relativeToGroup2 are coordinates of obj1 inside of coord system of group2. [import]uid: 80100 topic_id: 27058 reply_id: 109867[/import]

Thanks for the info, that’s exactly what I need. However, is there an equivalent method for rotation? [import]uid: 127214 topic_id: 27058 reply_id: 109881[/import]

Not that I know of, but that’s much easier to do manually: if object belongs to a group, it’s total rotation as it appears on screen is its own rotation + group rotation.

so, for obj1 in group1, and ob2 in group2

local totalRot1 = obj1.rotation + group1.rotation  
local totalRot2 = obj2.rotation + group2.rotation  
  
local angleDistance = totalRot1 - totalRot2  

or something like that, I am not sure exactly what values you need. [import]uid: 80100 topic_id: 27058 reply_id: 109885[/import]