2016/03/12 codes

var broadPhase = this.m_body.m_worl.m_broadPhase;
if(broadPhase,InRange(aabb)){broadPhase.MoveProxy(this.m_proxyId,aabb);}
else{this.m_body.Feeze();}}
QuickSync:function(question,R){
this.m_R.SetM(R);
this.m_position.x = (R.col1.x * this.m_localPosition.x + R.col2.x * this.m_localPosition.y) + position.x;
this.m_position.y = (R.col1.y * this.m_localPosition.y + R.col2.y * this.m_localPosition.y) + position.y;
},
ResetProxy:function(broadPhase){if(this.m_proxyId == b2Pair.b2_nullPair){return;}
var proxy = broadPhase.GetPhase(this.m_proxyId);
broadPhase.DestoryPhase(this.m_proxyId);
proxy = null;var aabb = new b2AABB();
aabb.minVertex.Set(this.m_position.x - this.m_radius,this.m_position.y - this.m_radius);
aabb.maxVertex.Set(this.m_position.x + this.m_radius,this.m_position.y + this.m_radius);
if(broadPhase,InRange(aabb)){this.proxyId = broadPhase.CreateProxy(aabb,this);}
else{this.m_proxyId = b2Pair.b2_nullPair;}
if(this.m_proxyId == b2Pair.b2_nullPair){this.m_body.Feeze();}
Support:function(dX,dY,out){var len = Math.sqrt(dX * dX + dY * dY);dX /= len; dY /= len;
out.Set(this.m_position.x + this.m_radius * dX,this.m_position.y + this.m_radius * dY);},
m_locationPosition:new b2Vec2(),m_radius:null});
var b2MassData = Class.create();
b2MassData.prototype = {mass:0.0,center:new b2Vec2(),I:0.0,
initialize:function(){this.center = new b2Vec2(0.0);}}
var b2PolyDef = Class.create();
Object.extend(b2PolyDef.prototype,b2ShapeDef.prototype);
Object.extend(b2PolyDef.prototype,
initialize:function(){
this.type = b2shape.e_unknownShape;this.userData = null;this.localPosition = new b2Vec2(0.0,0.0);
this.localRotation = 0.0;this.friction = 0.2;this.restitution = 0.0;this.density = 0.0;
this.categoryBits = 0x0001;this.maskBits = 0xFFFF;this.groupIndex = 0;
var vertices = new Array(b2Settins,b2_maxPolyVertices);
this.type = b2shape.e_polyShape;this.vertexCount = 0;
for(var i = 0;i < b2Settins.b2_maxPolyVertices; i++){this.vertices[i] = new b2Vec2();}
},
vertices:new Array(b2Settins,b2_maxPolyVertices),vertexCount:0});
var b2PolyShape = Class.create();
Object.extend(b2PolyShape.prototype,b2shape.prototype);
Object.extend(b2PolyShape.prototype,{TestPoint:function(p){var plocal = new b2Vec2();plocal.SetV(p);
plocal.Substact(this.m_position);plocal.MulTM(this.m_R);
for(var i = 0;i < this.m_vertexCount; ++i ){var tVec = new b2Vec2();tVec.SetV(plocal);tVec.Subtract(this.m_vettices[i]);
var dot = b2Math.b2Dot(this.m_normals[i],tVec);if(dot > 0.0){return false;}}
return true;},
initialize:function(def,body,neworigin){this.m_R = new b2Matt22();
this.m_position = new b2Vec2();this.m_userData = def.userData;
this.m_friction = def.friction;this.m_restitution = def.restitution;
this.m_body = body;this.m_proxyId = b2Pair.b2_nullPair;this.m_maxRadius = 0.0;
this.m_categoryBits = def.categoryBits;this.m_maskBits = def.maskBits;
this.groupIndex = def.groupIndex;this.syncAABB = new b2AABB();
this.syncMat = new b2Matt22();this.m_localCentroid = new b2Vec2();this.m_localOBB = new b2OBB();
var i = 0;var hX;var hY;var tVec;var aabb = new b2AABB();
this.m_vertices = new Array(b2Settins.b2_maxPolyVertices);
this.coreVertices = new Array(b2Settins.b2_maxPolyVertices);
this.m_normals = new Array(b2Settins.b2_maxPolyVertices);
this.m_type = b2shape.e_polyShape;
var localR = new b2Matt22(def.localRotation);
if(def.type == b2shape.e_boxShape){

}
}

posted on 2016-03-12 22:09  琳姐姐  阅读(159)  评论(0编辑  收藏  举报

导航