Real Position of a Sphere from Inside a Moving Container in Away3DLite Tutorial (Feb 24th 2010)
The position of an object inside a container is in the local space of the container. Using the current sceneMatrix transformation of the container parent on the contained primitive's position yeilds the absolute position to use as a reference in the overall scene.
This is how to get the real position of a sphere from inside a moving container:
myBasketball.x = PlayerContainer.sceneMatrix3D.transformVector(mySphere.position).x;
myBasketball.y = PlayerContainer.sceneMatrix3D.transformVector(mySphere.position).y;
myBasketball.z = PlayerContainer.sceneMatrix3D.transformVector(mySphere.position).z;
As you can image, if you place a 3D object at some point in an Objectcontainer like a sphere, then you can use these points for reference in placing things like other models, explosions or calculation of any distance from that reference sphere. Do note that a sphere is visible and handy for a while but a non-rendered object with a position member variable itself will do.
All kinds of things are possible using this!
Best regards.
No comments:
Post a Comment
Give me your best comment. *_*