Adding MD5mesh collision detection  

Software: Away3D 4.x

Jon Tetzlaff, Newbie
Posted: 11 January 2012 06:47 PM   Total Posts: 7

When I try and add collision detection between a hand I’ve imported (created with md5) and a sphere with awayphysics it causes my collision function to repeatedly fire.

var bodyShape:AWPBvhTriangleMeshShape = new AWPBvhTriangleMeshShape(_controller.mesh.geometry);
var 
body:AWPCollisionObject = new AWPCollisionObject(bodyShape_controller.mesh);
   
physicsWorld.addCollisionObject(body);
   
body.collisionFlags AWPCollisionFlags.CF_CHARACTER_OBJECT;
body.addEventListener(AWPEvent.COLLISION_ADDEDsphereCollisionAdded); 
private function sphereCollisionAdded(event:AWPEvent):void {
trace
("hit");
var 
material:ColorMaterial = new ColorMaterial(0xFFFFFF);
var 
mesh:Mesh Mesh(event.collisionObject.skin);
mesh.material material;

Could there be a problem with the model?

 

File Attachments
md5mesh.zip  (File Size: 22KB - Downloads: 254)
   

Alex Bogartz, Sr. Member
Posted: 11 January 2012 09:29 PM   Total Posts: 216   [ # 1 ]

Collisions aren’t a one time thing.  You can set up a state or timer to handle this.

if(state!=COLLIDING){
  //do something here
}
state=COLLIDING;
//set timer to check for not colliding

Something like that.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X