- package
- {
- import away3d.primitives.Skybox;
- import jiglib.physics.RigidBody;
- import away3d.materials.WireframeMaterial;
- import jiglib.plugin.away3d.Away3dMesh;
- import away3d.core.math.Number3D;
- import mx.collections.ArrayCollection;
- public class ApplicationManager extends BaseObject
- {
- protected var spheres:ArrayCollection = new ArrayCollection();
- public function ApplicationManager()
- {
- super();
- }
- public function startupApplicationManager(engineManager:EngineManager):ApplicationManager
- {
- super.startupBaseObject(engineManager);
- for (var i:int = 0; i < 20; i++)
- {
- var sphere:RigidBody = this.engineManager.physics.createSphere({radius:15, segmentsW:6, segmentsH:6});
- sphere.x = 100 - Math.random() * 200;
- sphere.y = Math.random() * 500;
- sphere.z = 500 - Math.random() * 100;
- sphere.material.restitution = 2;
- spheres.addItem(sphere);
- // This is how to access the engine specific mesh/do3d
- this.engineManager.physics.getMesh(sphere).material = this.engineManager.MyResourceManager.MetalTex;
- }
- var ground:RigidBody = this.engineManager.physics.createGround({segments:10, width:2000, height:2000}, -100);
- this.engineManager.physics.getMesh(ground).material = this.engineManager.MyResourceManager.GrassTex;
- return this;
- }
- public function reset():void
- {
- for each (var sphere:RigidBody in spheres)
- {
- sphere.x = 100 - Math.random() * 200;
- sphere.y = Math.random() * 500;
- sphere.z = 500 - Math.random() * 100;
- }
- }
- public override function shutdown():void
- {
- super.shutdown();
- }
- public override function enterFrame(dt:Number):void
- {
- }
- }
- }