package{ import flash.events.Event; import jiglib.plugin.sandy3d.Sandy3DPhysics; import jiglib.physics.RigidBody; import sandy.view.BasicView; /** * This is he HelloWorld example for using JigLib together with Sandy 3D. * It shows a sphere dressed in the wire frame material, falling under the influence of gravity. * It extends the Sandy BasicView to get the standard setup for a Sandy application, * including scene and camera * * @author petit@petitpub.com */ public class TestClass extends BasicView { private var physics:Sandy3DPhysics; /** * Initiate the physics engine, add the shpere and start rendering. */ public function TestClass() { // Initiate the BasicView super.init(400, 400); // Create an instance of the physics engine physics = new Sandy3DPhysics(scene, 1); // Create an object createSphere(); // Start rendering render(); } /** * Create the sphere object and add it to the scene. * The physics engine creates the rigid sphere object and the Sandy sphere. * It also adds the Shape3D to rhe root grup of the scene */ private function createSphere():void { var sphere:RigidBody = physics.createSphere("sphere", null, 20, 7, 5); } /** * Overriding the simpleRender method to call the time step method of the rendering engine. * @param event The ENTER_FRAME or timer event - the heart beat of Sandy */ override public function simpleRender( event:Event = null ):void { physics.step( ); super.simpleRender( event ); } } }