"use strict";var transferableMessage=self.webkitPostMessage||self.postMessage,MESSAGE_TYPES={WORLDREPORT:0,COLLISIONREPORT:1,VEHICLEREPORT:2,CONSTRAINTREPORT:3},_object,_vector,_transform,public_functions={},getShapeFromCache,setShapeCache,createShape,reportWorld,reportVehicles,reportCollisions,reportConstraints,fixedTimeStep,rateLimit,last_simulation_time,last_simulation_duration=0,world,transform,_vec3_1,_vec3_2,_vec3_3,_quat,_objects={},_vehicles={},_constraints={},_materials={},_objects_ammo={},_num_objects=0,_num_wheels=0,_num_constraints=0,_object_shapes={},_motion_states={},_noncached_shapes={},_compound_shapes={},REPORT_CHUNKSIZE,WORLDREPORT_ITEMSIZE=14,worldreport,COLLISIONREPORT_ITEMSIZE=5,collisionreport,VEHICLEREPORT_ITEMSIZE=9,vehiclereport,CONSTRAINTREPORT_ITEMSIZE=6,constraintreport;var ab=new ArrayBuffer(1);transferableMessage(ab,[ab]);var SUPPORT_TRANSFERABLE=ab.byteLength===0;getShapeFromCache=function(cache_key){if(_object_shapes[cache_key]!==undefined){return _object_shapes[cache_key]}return null};setShapeCache=function(cache_key,shape){_object_shapes[cache_key]=shape};createShape=function(description){var cache_key,shape;_transform.setIdentity();switch(description.type){case"plane":cache_key="plane_"+description.normal.x+"_"+description.normal.y+"_"+description.normal.z;if((shape=getShapeFromCache(cache_key))===null){_vec3_1.setX(description.normal.x);_vec3_1.setY(description.normal.y);_vec3_1.setZ(description.normal.z);shape=new Ammo.btStaticPlaneShape(_vec3_1,0);setShapeCache(cache_key,shape)}break;case"box":cache_key="box_"+description.width+"_"+description.height+"_"+description.depth;if((shape=getShapeFromCache(cache_key))===null){_vec3_1.setX(description.width/2);_vec3_1.setY(description.height/2);_vec3_1.setZ(description.depth/2);shape=new Ammo.btBoxShape(_vec3_1);setShapeCache(cache_key,shape)}break;case"sphere":cache_key="sphere_"+description.radius;if((shape=getShapeFromCache(cache_key))===null){shape=new Ammo.btSphereShape(description.radius);setShapeCache(cache_key,shape)}break;case"cylinder":cache_key="cylinder_"+description.width+"_"+description.height+"_"+description.depth;if((shape=getShapeFromCache(cache_key))===null){_vec3_1.setX(description.width/2);_vec3_1.setY(description.height/2);_vec3_1.setZ(description.depth/2);shape=new Ammo.btCylinderShape(_vec3_1);setShapeCache(cache_key,shape)}break;case"capsule":cache_key="capsule_"+description.radius+"_"+description.height;if((shape=getShapeFromCache(cache_key))===null){shape=new Ammo.btCapsuleShape(description.radius,description.height-2*description.radius);setShapeCache(cache_key,shape)}break;case"cone":cache_key="cone_"+description.radius+"_"+description.height;if((shape=getShapeFromCache(cache_key))===null){shape=new Ammo.btConeShape(description.radius,description.height);setShapeCache(cache_key,shape)}break;case"concave":var i,triangle,triangle_mesh=new Ammo.btTriangleMesh;if(!description.triangles.length)return false;for(i=0;i