i set collisionCallbackOn is true than rigidBody.addEventListener(AWPEvent.COLLISION_ADDED, collision);
when the collision occurred error
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at global/AWPC_Run::physicsStepInC()
at awayphysics.dynamics::AWPDynamicsWorld/step()[E:\ActionScript3\FProject\Maze\src\awayphysics\dynamics\AWPDynamicsWorld.as:334]
at Maze/enterFrame()[E:\ActionScript3\FProject\Maze\src\Maze.as:86]
thank…
thank…
this is my all code
private var _view:View3D;
private var _physics:AWPDynamicsWorld;
public function Maze()
{
_view = new View3D();
this.addChild(_view);
_physics = new AWPDynamicsWorld();
_physics.initWithDbvtBroadphase();
_physics.collisionCallbackOn = true;
_physics.gravity = new Vector3D(0, -10, 0);
var floor:Mesh = new Mesh(new CubeGeometry(1000, 100, 1000));
_view.scene.addChild(floor);
var awpBox:AWPBvhTriangleMeshShape = new AWPBvhTriangleMeshShape(floor.geometry);
var rigidBody:AWPRigidBody = new AWPRigidBody(awpBox, floor, 0);
rigidBody.addEventListener(AWPEvent.COLLISION_ADDED, collision);
_physics.addRigidBody(rigidBody);
var box:Mesh = new Mesh(new CubeGeometry(100, 100, 100), new ColorMaterial(0xff0000));
box.y = 900;
_view.scene.addChild(box);
var awpBox1:AWPBoxShape = new AWPBoxShape(100, 100, 100);
var rigidBody:AWPRigidBody = new AWPRigidBody(awpBox1, box, 1);
rigidBody.y = 900;
_physics.addRigidBody(rigidBody);
_view.camera.y = 500;
_view.camera.z = -1200;
this.addEventListener(Event.ENTER_FRAME, enterFrame);
}
//============================private function=============
//============================protected function=============
//============================event========================
private function collision(e:AWPEvent):void
{
}
private function enterFrame(e:Event):void
{
_view.render();
_physics.step(60/1);
}