Away3D - child object rotation around local axes

I can’t recall from AS3 days how to rotate child object around its local axes (although I’m almost sure, there is a method for this in Away3D).

Assuming we have parent and child object:

my_parent_object:ObjectContainer3D;
my_child_object:ObjectContainer3D;

my_parent_object.addChild(my_child_object);

Child object automatically adopts axes of its parent object. So it doesn’t matter if you use:
my_child_object.rotationX = 45;
or:
my_child_object.transform.appendRotation(45, Vector3D.X_AXIS);
or:
my_child_object.pitch(45);

it still rotates around parent axes.

Does anyone remember how this can be done?

I think it was something with Matrix3D… (not sure)

Hi. I’m not sure what exactly you are trying to achieve. Any object always scales, then rotates, then translates locally. Then, if it has a parent, it appends parent’s transform, that is how child-parent system works in 2d flash, etc. It doesn’t matter in what sequence rotations or coordinates are specified, the order of transformation will always be the same… However, you can override any of transform and sceneTransform calculations of a child and send any scene transformation matrix3D that you want, calculated by yourself, but sounds like it makes no sense to use a parent in this case. Maybe i just can’t understand what do you mean, especially if you have already done it successfully.

1 Like

Thank you for the answer.

So how would you rotate child_object around ‘axes 2’ (depicted on the image) in Away3D?

:

Hi! Sorry, i still can’t get you))
Look at my sample HERE
Cube is child object of a parent plane. It has some translation relatively to parent center. You can rotate (plane.rotationY and plane.rotationX) parent plane by mouse (camera never moves!), but child cube always rotates around it’s local Y axis (just cube.rotationY += time), no matter with parent rotation. It is logical and understandable, I just can’t imagine any other behavior of a child object. Do you try to achieve something else?
I can’t understand what is “Axes 2” in your pic. There is only world global axes of scene, parent moves and rotates around them (we can call it axes 0), and axes 1 - it is parent’s translation and rotation, so childs will locally moves and rotates around them. What is “axes 2”, where did they come from?

UPD: MAYBE you just want to rotate child around world axes, using parent’s transformation only for child translation (not transform), something like THIS?))) If this is the case, it would be stupid to use parenting system and untransform rotations back… :smile: