Skip to content

Commit

Permalink
improved the freezing system
Browse files Browse the repository at this point in the history
  • Loading branch information
muzerly committed Mar 12, 2011
1 parent b02e082 commit 2b8be8b
Show file tree
Hide file tree
Showing 14 changed files with 126 additions and 203 deletions.
3 changes: 2 additions & 1 deletion fp11/examples/Away3DCarDrive.as
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package
import flash.geom.Vector3D;
import flash.ui.Keyboard;

import jiglib.cof.JConfig;
import jiglib.debug.Stats;
import jiglib.math.*;
import jiglib.physics.*;
Expand Down Expand Up @@ -85,7 +86,7 @@ package
for (var i:int = 0; i < 3; i++)
{
boxBody[i] = physics.createCube(materia, 60, 50, 80 );
boxBody[i].moveTo(new Vector3D(0, 10 + (30 * i + 30), 0));
boxBody[i].moveTo(new Vector3D(0, 10 + (50 * i + 50), 0));
}

ResourceManager.instance.addEventListener(ResourceEvent.RESOURCE_RETRIEVED, onResourceRetrieved);
Expand Down
Binary file modified fp11/examples/Away3DGridSystem.swf
Binary file not shown.
Binary file added fp11/examples/Away3DStackingTest.swf
Binary file not shown.
Binary file added fp11/examples/Away3DTerrainTest.swf
Binary file not shown.
4 changes: 2 additions & 2 deletions fp11/examples/Away3DTriangleMesh.as
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ package
materia = new ColorMaterial(0xeeee00);
materia.lights=[mylight];
ballBodies = new Vector.<RigidBody>();
for (var i:int = 0; i < 10; i++)
for (var i:int = 0; i < 15; i++)
{
ballBodies[i] = physics.createSphere(materia, 50);
ballBodies[i].moveTo(new Vector3D( -1000+2500*Math.random(),1000+1000*Math.random(), -1000+2500*Math.random()));
}

boxBodies = new Vector.<RigidBody>();
for (i = 0; i < 10; i++)
for (i = 0; i < 15; i++)
{
boxBodies[i] = physics.createCube(materia, 100, 80, 60 );
boxBodies[i].moveTo(new Vector3D(-1000+2500*Math.random(), 1000+1000*Math.random(), -1000+2500*Math.random()));
Expand Down
Binary file modified fp11/examples/CollisionEventTest.swf
Binary file not shown.
9 changes: 2 additions & 7 deletions fp11/src/jiglib/collision/CollisionSystemAbstract.as
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@

public function addCollisionBody(body:RigidBody):void
{
if (!findBody(body))
if (collBody.indexOf(body) < 0)
collBody.push(body);
}

public function removeCollisionBody(body:RigidBody):void
{
if (findBody(body))
if (collBody.indexOf(body) >= 0)
collBody.splice(collBody.indexOf(body), 1);
}

Expand Down Expand Up @@ -158,11 +158,6 @@
{
return _numCollisionsChecks;
}

protected function findBody(body:RigidBody):Boolean
{
return collBody.indexOf(body) > -1;
}

protected function checkCollidables(body0:RigidBody, body1:RigidBody):Boolean
{
Expand Down
4 changes: 2 additions & 2 deletions fp11/src/jiglib/collision/CollisionSystemGrid.as
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ package jiglib.collision

override public function addCollisionBody(body:RigidBody):void
{
if (!findBody(body))
if (collBody.indexOf(body) < 0)
collBody.push(body);

body.collisionSystem = this;
Expand All @@ -187,7 +187,7 @@ package jiglib.collision
body.externalData = null;
}

if (findBody(body))
if (collBody.indexOf(body) >= 0)
collBody.splice(collBody.indexOf(body), 1);
}

Expand Down
Loading

0 comments on commit 2b8be8b

Please sign in to comment.