AS3 Rotate 3D object around point in space

209 views Asked by At

I use

appendRotation(_Y, Vector3D.Y_AXIS);

to rotate an object around its center. works fine.

when I want the object to rotate around the center of scene, I use

prependRotation( _Y, Vector3D.Y_AXIS , new Vector3D( 0, 0, 0 ) );

works fine.

but if I want to rotate object around some point in space like this:

prependRotation( _Y, Vector3D.Y_AXIS , new Vector3D( 10, 10, 10 ) );

it doesn't work, the object gets totaly distorted, can anyone give me a hint, what am I doing wrong?

1

There are 1 answers

2
stesel On

It could be resolved by adding your object into parent container. then move object to proper position: appendTranslation(10, 10, 10), and then apply rotation to parent container: appendRotation(_Y, Vector3D.Y_AXIS).