mirror of
https://github.com/MapMakersAndProgrammers/TankiOnline2.0DemoClient.git
synced 2025-10-26 18:09:07 -07:00
Initial commit
This commit is contained in:
346
src/package_92/name_271.as
Normal file
346
src/package_92/name_271.as
Normal file
@@ -0,0 +1,346 @@
|
||||
package package_92
|
||||
{
|
||||
import package_46.Matrix3;
|
||||
import package_46.Matrix4;
|
||||
import package_46.name_194;
|
||||
import package_46.name_566;
|
||||
import package_76.name_235;
|
||||
import package_76.name_604;
|
||||
import package_90.name_386;
|
||||
|
||||
public class name_271
|
||||
{
|
||||
public static var linDamping:Number = 0.997;
|
||||
|
||||
public static var rotDamping:Number = 0.997;
|
||||
|
||||
private static var _r:name_194 = new name_194();
|
||||
|
||||
private static var _f:name_194 = new name_194();
|
||||
|
||||
private static var _q:name_566 = new name_566();
|
||||
|
||||
public var id:int;
|
||||
|
||||
public var name:String;
|
||||
|
||||
public var scene:name_467;
|
||||
|
||||
public var var_499:Boolean = true;
|
||||
|
||||
public var var_502:Boolean = false;
|
||||
|
||||
public var var_498:int;
|
||||
|
||||
public var var_501:Boolean = false;
|
||||
|
||||
public var var_500:Boolean = true;
|
||||
|
||||
public var aabb:name_386 = new name_386();
|
||||
|
||||
public var postCollisionFilter:name_604;
|
||||
|
||||
public var state:name_599 = new name_599();
|
||||
|
||||
public var var_492:name_599 = new name_599();
|
||||
|
||||
public var var_497:name_194 = new name_194();
|
||||
|
||||
public var var_496:name_194 = new name_194();
|
||||
|
||||
public var material:name_600 = new name_600();
|
||||
|
||||
public var invMass:Number = 1;
|
||||
|
||||
public var invInertia:Matrix3 = new Matrix3();
|
||||
|
||||
public var var_495:Matrix3 = new Matrix3();
|
||||
|
||||
public var baseMatrix:Matrix3 = new Matrix3();
|
||||
|
||||
public var collisionPrimitives:name_601;
|
||||
|
||||
public var var_494:name_194 = new name_194();
|
||||
|
||||
public var var_493:name_194 = new name_194();
|
||||
|
||||
public var data:Object;
|
||||
|
||||
public function name_271(invMass:Number, invInertia:Matrix3)
|
||||
{
|
||||
super();
|
||||
this.invMass = invMass;
|
||||
this.invInertia.copy(invInertia);
|
||||
}
|
||||
|
||||
public function name_580(primitive:name_235, localTransform:Matrix4 = null) : void
|
||||
{
|
||||
if(primitive == null)
|
||||
{
|
||||
throw new ArgumentError("Primitive cannot be null");
|
||||
}
|
||||
if(this.collisionPrimitives == null)
|
||||
{
|
||||
this.collisionPrimitives = new name_601();
|
||||
}
|
||||
this.collisionPrimitives.append(primitive);
|
||||
primitive.method_373(this,localTransform);
|
||||
}
|
||||
|
||||
public function method_509(primitive:name_235) : void
|
||||
{
|
||||
if(this.collisionPrimitives == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
primitive.method_373(null);
|
||||
this.collisionPrimitives.remove(primitive);
|
||||
if(this.collisionPrimitives.size == 0)
|
||||
{
|
||||
this.collisionPrimitives = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function interpolate(t:Number, pos:name_194, orientation:name_566) : void
|
||||
{
|
||||
var t1:Number = NaN;
|
||||
t1 = 1 - t;
|
||||
pos.x = this.var_492.position.x * t1 + this.state.position.x * t;
|
||||
pos.y = this.var_492.position.y * t1 + this.state.position.y * t;
|
||||
pos.z = this.var_492.position.z * t1 + this.state.position.z * t;
|
||||
orientation.w = this.var_492.orientation.w * t1 + this.state.orientation.w * t;
|
||||
orientation.x = this.var_492.orientation.x * t1 + this.state.orientation.x * t;
|
||||
orientation.y = this.var_492.orientation.y * t1 + this.state.orientation.y * t;
|
||||
orientation.z = this.var_492.orientation.z * t1 + this.state.orientation.z * t;
|
||||
}
|
||||
|
||||
public function method_515(t:Number, pos:name_194, orientation:name_566) : void
|
||||
{
|
||||
var t1:Number = NaN;
|
||||
t1 = 1 - t;
|
||||
pos.x = this.var_492.position.x * t1 + this.state.position.x * t;
|
||||
pos.y = this.var_492.position.y * t1 + this.state.position.y * t;
|
||||
pos.z = this.var_492.position.z * t1 + this.state.position.z * t;
|
||||
orientation.name_602(this.var_492.orientation,this.state.orientation,t);
|
||||
}
|
||||
|
||||
public function method_517(t:Number, m:Matrix4) : void
|
||||
{
|
||||
var t1:Number = NaN;
|
||||
t1 = 1 - t;
|
||||
m.d = this.var_492.position.x * t1 + this.state.position.x * t;
|
||||
m.h = this.var_492.position.y * t1 + this.state.position.y * t;
|
||||
m.l = this.var_492.position.z * t1 + this.state.position.z * t;
|
||||
_q.w = this.var_492.orientation.w * t1 + this.state.orientation.w * t;
|
||||
_q.x = this.var_492.orientation.x * t1 + this.state.orientation.x * t;
|
||||
_q.y = this.var_492.orientation.y * t1 + this.state.orientation.y * t;
|
||||
_q.z = this.var_492.orientation.z * t1 + this.state.orientation.z * t;
|
||||
_q.normalize();
|
||||
_q.toMatrix4(m);
|
||||
}
|
||||
|
||||
public function method_514(t:Number, m:Matrix4) : void
|
||||
{
|
||||
var t1:Number = 1 - t;
|
||||
m.d = this.var_492.position.x * t1 + this.state.position.x * t;
|
||||
m.h = this.var_492.position.y * t1 + this.state.position.y * t;
|
||||
m.l = this.var_492.position.z * t1 + this.state.position.z * t;
|
||||
_q.name_602(this.var_492.orientation,this.state.orientation,t);
|
||||
_q.normalize();
|
||||
_q.toMatrix4(m);
|
||||
}
|
||||
|
||||
public function name_201(pos:name_194) : void
|
||||
{
|
||||
this.state.position.copy(pos);
|
||||
}
|
||||
|
||||
public function name_75(x:Number, y:Number, z:Number) : void
|
||||
{
|
||||
this.state.position.reset(x,y,z);
|
||||
}
|
||||
|
||||
public function name_587(vel:name_194) : void
|
||||
{
|
||||
this.state.velocity.copy(vel);
|
||||
}
|
||||
|
||||
public function name_588(x:Number, y:Number, z:Number) : void
|
||||
{
|
||||
this.state.velocity.reset(x,y,z);
|
||||
}
|
||||
|
||||
public function method_368(rot:name_194) : void
|
||||
{
|
||||
this.state.rotation.copy(rot);
|
||||
}
|
||||
|
||||
public function name_332(x:Number, y:Number, z:Number) : void
|
||||
{
|
||||
this.state.rotation.reset(x,y,z);
|
||||
}
|
||||
|
||||
public function name_352(q:name_566) : void
|
||||
{
|
||||
this.state.orientation.copy(q);
|
||||
}
|
||||
|
||||
public function method_484(w:Number, x:Number, y:Number, z:Number) : void
|
||||
{
|
||||
this.state.orientation.reset(w,x,y,z);
|
||||
}
|
||||
|
||||
public function method_518(r:name_194, dir:name_194, magnitude:Number) : void
|
||||
{
|
||||
var x:Number = NaN;
|
||||
var y:Number = NaN;
|
||||
var d:Number = magnitude * this.invMass;
|
||||
this.state.velocity.x += d * dir.x;
|
||||
this.state.velocity.y += d * dir.y;
|
||||
this.state.velocity.z += d * dir.z;
|
||||
x = (r.y * dir.z - r.z * dir.y) * magnitude;
|
||||
y = (r.z * dir.x - r.x * dir.z) * magnitude;
|
||||
var z:Number = (r.x * dir.y - r.y * dir.x) * magnitude;
|
||||
this.state.rotation.x += this.var_495.a * x + this.var_495.b * y + this.var_495.c * z;
|
||||
this.state.rotation.y += this.var_495.e * x + this.var_495.f * y + this.var_495.g * z;
|
||||
this.state.rotation.z += this.var_495.i * x + this.var_495.j * y + this.var_495.k * z;
|
||||
}
|
||||
|
||||
public function name_585(f:name_194) : void
|
||||
{
|
||||
this.var_494.add(f);
|
||||
}
|
||||
|
||||
public function method_519(fx:Number, fy:Number, fz:Number) : void
|
||||
{
|
||||
this.var_494.x += fx;
|
||||
this.var_494.y += fy;
|
||||
this.var_494.z += fz;
|
||||
}
|
||||
|
||||
public function method_507(px:Number, py:Number, pz:Number, fx:Number, fy:Number, fz:Number) : void
|
||||
{
|
||||
var rx:Number = NaN;
|
||||
this.var_494.x += fx;
|
||||
this.var_494.y += fy;
|
||||
this.var_494.z += fz;
|
||||
var pos:name_194 = this.state.position;
|
||||
rx = px - pos.x;
|
||||
var ry:Number = py - pos.y;
|
||||
var rz:Number = pz - pos.z;
|
||||
this.var_493.x += ry * fz - rz * fy;
|
||||
this.var_493.y += rz * fx - rx * fz;
|
||||
this.var_493.z += rx * fy - ry * fx;
|
||||
}
|
||||
|
||||
public function name_525(pos:name_194, force:name_194) : void
|
||||
{
|
||||
this.var_494.add(force);
|
||||
this.var_493.add(_r.method_366(pos,this.state.position).method_360(force));
|
||||
}
|
||||
|
||||
public function name_556(pos:name_194, force:name_194, scale:Number) : void
|
||||
{
|
||||
_f.x = scale * force.x;
|
||||
_f.y = scale * force.y;
|
||||
_f.z = scale * force.z;
|
||||
this.var_494.add(_f);
|
||||
this.var_493.add(_r.method_366(pos,this.state.position).method_360(_f));
|
||||
}
|
||||
|
||||
public function method_516(pos:name_194, force:name_194) : void
|
||||
{
|
||||
this.baseMatrix.method_345(pos,_r);
|
||||
this.baseMatrix.method_345(force,_f);
|
||||
this.var_494.add(_f);
|
||||
this.var_493.add(_r.method_360(_f));
|
||||
}
|
||||
|
||||
public function method_521(localPos:name_194, worldForce:name_194) : void
|
||||
{
|
||||
this.baseMatrix.method_345(localPos,_r);
|
||||
this.var_494.add(worldForce);
|
||||
this.var_493.add(_r.method_360(worldForce));
|
||||
}
|
||||
|
||||
public function method_520(t:name_194) : void
|
||||
{
|
||||
this.var_493.add(t);
|
||||
}
|
||||
|
||||
internal function method_513() : void
|
||||
{
|
||||
this.var_494.x = this.var_494.y = this.var_494.z = 0;
|
||||
this.var_493.x = this.var_493.y = this.var_493.z = 0;
|
||||
}
|
||||
|
||||
internal function method_508() : void
|
||||
{
|
||||
this.var_497.x = this.var_494.x * this.invMass;
|
||||
this.var_497.y = this.var_494.y * this.invMass;
|
||||
this.var_497.z = this.var_494.z * this.invMass;
|
||||
this.var_496.x = this.var_495.a * this.var_493.x + this.var_495.b * this.var_493.y + this.var_495.c * this.var_493.z;
|
||||
this.var_496.y = this.var_495.e * this.var_493.x + this.var_495.f * this.var_493.y + this.var_495.g * this.var_493.z;
|
||||
this.var_496.z = this.var_495.i * this.var_493.x + this.var_495.j * this.var_493.y + this.var_495.k * this.var_493.z;
|
||||
}
|
||||
|
||||
public function method_512() : void
|
||||
{
|
||||
var item:name_513 = null;
|
||||
var primitive:name_235 = null;
|
||||
this.state.orientation.toMatrix3(this.baseMatrix);
|
||||
this.var_495.copy(this.invInertia).append(this.baseMatrix).method_348(this.baseMatrix);
|
||||
if(this.collisionPrimitives != null)
|
||||
{
|
||||
this.aabb.name_584();
|
||||
for(item = this.collisionPrimitives.head; item != null; )
|
||||
{
|
||||
primitive = item.primitive;
|
||||
primitive.transform.method_350(this.baseMatrix,this.state.position);
|
||||
if(primitive.localTransform != null)
|
||||
{
|
||||
primitive.transform.prepend(primitive.localTransform);
|
||||
}
|
||||
primitive.calculateAABB();
|
||||
this.aabb.name_583(primitive.aabb);
|
||||
item = item.next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function name_586() : void
|
||||
{
|
||||
this.var_492.copy(this.state);
|
||||
}
|
||||
|
||||
internal function method_506() : void
|
||||
{
|
||||
this.state.copy(this.var_492);
|
||||
}
|
||||
|
||||
internal function method_510(dt:Number) : void
|
||||
{
|
||||
this.state.velocity.x += this.var_497.x * dt;
|
||||
this.state.velocity.y += this.var_497.y * dt;
|
||||
this.state.velocity.z += this.var_497.z * dt;
|
||||
this.state.rotation.x += this.var_496.x * dt;
|
||||
this.state.rotation.y += this.var_496.y * dt;
|
||||
this.state.rotation.z += this.var_496.z * dt;
|
||||
this.state.velocity.x *= linDamping;
|
||||
this.state.velocity.y *= linDamping;
|
||||
this.state.velocity.z *= linDamping;
|
||||
this.state.rotation.x *= rotDamping;
|
||||
this.state.rotation.y *= rotDamping;
|
||||
this.state.rotation.z *= rotDamping;
|
||||
}
|
||||
|
||||
internal function method_511(dt:Number) : void
|
||||
{
|
||||
this.state.position.x += this.state.velocity.x * dt;
|
||||
this.state.position.y += this.state.velocity.y * dt;
|
||||
this.state.position.z += this.state.velocity.z * dt;
|
||||
this.state.orientation.name_603(this.state.rotation,dt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
519
src/package_92/name_467.as
Normal file
519
src/package_92/name_467.as
Normal file
@@ -0,0 +1,519 @@
|
||||
package package_92
|
||||
{
|
||||
import package_122.name_672;
|
||||
import package_46.Matrix3;
|
||||
import package_46.name_194;
|
||||
import package_76.name_256;
|
||||
import package_76.name_682;
|
||||
|
||||
public class name_467
|
||||
{
|
||||
private static var lastBodyId:int;
|
||||
|
||||
public const const_2:int = 1000;
|
||||
|
||||
public var var_605:int = 10;
|
||||
|
||||
public var name_471:Number = 0.1;
|
||||
|
||||
public var name_474:Number = 0.5;
|
||||
|
||||
public var var_608:int = 5;
|
||||
|
||||
public var var_603:int = 5;
|
||||
|
||||
public var name_475:Boolean = false;
|
||||
|
||||
public var var_606:int = 10;
|
||||
|
||||
public var var_604:Number = 1;
|
||||
|
||||
public var var_607:Number = 0.01;
|
||||
|
||||
public var name_567:name_194 = new name_194(0,0,-9.8);
|
||||
|
||||
public var var_602:Number = 9.8;
|
||||
|
||||
public var collisionDetector:name_256;
|
||||
|
||||
public var name_605:name_681 = new name_681();
|
||||
|
||||
public var contacts:name_630;
|
||||
|
||||
public var var_599:Vector.<name_672> = new Vector.<name_672>();
|
||||
|
||||
public var var_598:int;
|
||||
|
||||
public var var_601:int;
|
||||
|
||||
public var time:int;
|
||||
|
||||
private var var_600:name_630;
|
||||
|
||||
private var var_597:name_194 = new name_194();
|
||||
|
||||
private var _v:name_194 = new name_194();
|
||||
|
||||
public function name_467()
|
||||
{
|
||||
super();
|
||||
this.contacts = new name_630(0);
|
||||
var contact:name_630 = this.contacts;
|
||||
for(var i:int = 1; i < this.const_2; i++)
|
||||
{
|
||||
contact.next = new name_630(i);
|
||||
contact = contact.next;
|
||||
}
|
||||
this.collisionDetector = new name_682();
|
||||
}
|
||||
|
||||
public function get gravity() : name_194
|
||||
{
|
||||
return this.name_567.clone();
|
||||
}
|
||||
|
||||
public function set gravity(value:name_194) : void
|
||||
{
|
||||
this.name_567.copy(value);
|
||||
this.var_602 = this.name_567.length();
|
||||
}
|
||||
|
||||
public function name_592(body:name_271) : void
|
||||
{
|
||||
body.id = lastBodyId++;
|
||||
body.scene = this;
|
||||
this.name_605.append(body);
|
||||
}
|
||||
|
||||
public function name_593(body:name_271) : void
|
||||
{
|
||||
if(this.name_605.remove(body))
|
||||
{
|
||||
body.scene = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function method_679(c:name_672) : void
|
||||
{
|
||||
var _loc2_:* = this.var_598++;
|
||||
this.var_599[_loc2_] = c;
|
||||
c.world = this;
|
||||
}
|
||||
|
||||
public function method_678(c:name_672) : Boolean
|
||||
{
|
||||
var idx:int = int(this.var_599.indexOf(c));
|
||||
if(idx < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.var_599.splice(idx,1);
|
||||
--this.var_598;
|
||||
c.world = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
private function method_676(dt:Number) : void
|
||||
{
|
||||
var body:name_271 = null;
|
||||
for(var item:name_671 = this.name_605.head; item != null; )
|
||||
{
|
||||
body = item.body;
|
||||
body.method_508();
|
||||
if(body.var_500 && body.var_499 && !body.var_501)
|
||||
{
|
||||
body.var_497.x += this.name_567.x;
|
||||
body.var_497.y += this.name_567.y;
|
||||
body.var_497.z += this.name_567.z;
|
||||
}
|
||||
item = item.next;
|
||||
}
|
||||
}
|
||||
|
||||
private function method_673(dt:Number) : void
|
||||
{
|
||||
var body:name_271 = null;
|
||||
var b1:name_271 = null;
|
||||
var b2:name_271 = null;
|
||||
var j:int = 0;
|
||||
var cp:name_674 = null;
|
||||
var bPos:name_194 = null;
|
||||
for(var item:name_671 = this.name_605.head; item != null; )
|
||||
{
|
||||
body = item.body;
|
||||
if(!body.var_501)
|
||||
{
|
||||
body.name_586();
|
||||
if(this.name_475)
|
||||
{
|
||||
body.method_510(dt);
|
||||
body.method_511(dt);
|
||||
}
|
||||
body.method_512();
|
||||
}
|
||||
item = item.next;
|
||||
}
|
||||
this.var_600 = this.collisionDetector.method_553(this.contacts);
|
||||
for(var contact:name_630 = this.contacts; contact != this.var_600; )
|
||||
{
|
||||
b1 = contact.body1;
|
||||
b2 = contact.body2;
|
||||
for(j = 0; j < contact.name_679; )
|
||||
{
|
||||
cp = contact.points[j];
|
||||
bPos = b1.state.position;
|
||||
cp.r1.x = cp.pos.x - bPos.x;
|
||||
cp.r1.y = cp.pos.y - bPos.y;
|
||||
cp.r1.z = cp.pos.z - bPos.z;
|
||||
if(b2 != null)
|
||||
{
|
||||
bPos = b2.state.position;
|
||||
cp.r2.x = cp.pos.x - bPos.x;
|
||||
cp.r2.y = cp.pos.y - bPos.y;
|
||||
cp.r2.z = cp.pos.z - bPos.z;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
contact = contact.next;
|
||||
}
|
||||
if(this.name_475)
|
||||
{
|
||||
for(item = this.name_605.head; item != null; )
|
||||
{
|
||||
body = item.body;
|
||||
if(!body.var_501)
|
||||
{
|
||||
body.method_506();
|
||||
body.method_512();
|
||||
}
|
||||
item = item.next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function method_671(dt:Number) : void
|
||||
{
|
||||
var b1:name_271 = null;
|
||||
var b2:name_271 = null;
|
||||
var j:int = 0;
|
||||
var cp:name_674 = null;
|
||||
var constraint:name_672 = null;
|
||||
for(var contact:name_630 = this.contacts; contact != this.var_600; )
|
||||
{
|
||||
b1 = contact.body1;
|
||||
b2 = contact.body2;
|
||||
if(b1.var_501)
|
||||
{
|
||||
b1.var_501 = false;
|
||||
b1.var_498 = 0;
|
||||
}
|
||||
if(b2 != null && b2.var_501)
|
||||
{
|
||||
b2.var_501 = false;
|
||||
b2.var_498 = 0;
|
||||
}
|
||||
contact.name_673 = b1.material.name_673;
|
||||
if(b2 != null && b2.material.name_673 < contact.name_673)
|
||||
{
|
||||
contact.name_673 = b2.material.name_673;
|
||||
}
|
||||
contact.name_581 = b1.material.name_581;
|
||||
if(b2 != null && b2.material.name_581 < contact.name_581)
|
||||
{
|
||||
contact.name_581 = b2.material.name_581;
|
||||
}
|
||||
for(j = 0; j < contact.name_679; )
|
||||
{
|
||||
cp = contact.points[j];
|
||||
cp.name_676 = 0;
|
||||
cp.name_675 = 0;
|
||||
if(b1.var_499)
|
||||
{
|
||||
cp.angularInertia1 = this._v.cross2(cp.r1,contact.normal).transform3(b1.var_495).method_360(cp.r1).dot(contact.normal);
|
||||
cp.name_675 += b1.invMass + cp.angularInertia1;
|
||||
}
|
||||
if(b2 != null && b2.var_499)
|
||||
{
|
||||
cp.angularInertia2 = this._v.cross2(cp.r2,contact.normal).transform3(b2.var_495).method_360(cp.r2).dot(contact.normal);
|
||||
cp.name_675 += b2.invMass + cp.angularInertia2;
|
||||
}
|
||||
this.method_668(b1,b2,cp,this._v);
|
||||
cp.name_677 = this._v.dot(contact.normal);
|
||||
if(cp.name_677 < 0)
|
||||
{
|
||||
cp.name_677 = -contact.name_673 * cp.name_677;
|
||||
}
|
||||
cp.name_678 = cp.penetration > this.name_471 ? (cp.penetration - this.name_471) / (this.var_605 * dt) : 0;
|
||||
if(cp.name_678 > this.name_474)
|
||||
{
|
||||
cp.name_678 = this.name_474;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
contact = contact.next;
|
||||
}
|
||||
for(var i:int = 0; i < this.var_598; i++)
|
||||
{
|
||||
constraint = this.var_599[i];
|
||||
constraint.name_684(dt);
|
||||
}
|
||||
}
|
||||
|
||||
private function method_669(dt:Number, forceInelastic:Boolean) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var contact:name_630 = null;
|
||||
var constraint:name_672 = null;
|
||||
var iterNum:int = forceInelastic ? this.var_603 : this.var_608;
|
||||
var forwardLoop:Boolean = false;
|
||||
for(var iter:int = 0; iter < iterNum; iter++)
|
||||
{
|
||||
forwardLoop = !forwardLoop;
|
||||
for(contact = this.contacts; contact != this.var_600; )
|
||||
{
|
||||
this.method_675(contact,forceInelastic,forwardLoop);
|
||||
contact = contact.next;
|
||||
}
|
||||
for(i = 0; i < this.var_598; i++)
|
||||
{
|
||||
constraint = this.var_599[i];
|
||||
constraint.name_683(dt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function method_675(contactInfo:name_630, forceInelastic:Boolean, forwardLoop:Boolean) : void
|
||||
{
|
||||
var i:int = 0;
|
||||
var b1:name_271 = contactInfo.body1;
|
||||
var b2:name_271 = contactInfo.body2;
|
||||
var normal:name_194 = contactInfo.normal;
|
||||
if(forwardLoop)
|
||||
{
|
||||
for(i = 0; i < contactInfo.name_679; this.method_670(i,b1,b2,contactInfo,normal,forceInelastic),i++)
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(i = contactInfo.name_679 - 1; i >= 0; this.method_670(i,b1,b2,contactInfo,normal,forceInelastic),i--)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function method_670(idx:int, b1:name_271, b2:name_271, contact:name_630, normal:name_194, forceInelastic:Boolean) : void
|
||||
{
|
||||
var r:name_194 = null;
|
||||
var m:Matrix3 = null;
|
||||
var xx:Number = NaN;
|
||||
var yy:Number = NaN;
|
||||
var zz:Number = NaN;
|
||||
var minSpeVel:Number = NaN;
|
||||
var cp:name_674 = contact.points[idx];
|
||||
if(!forceInelastic)
|
||||
{
|
||||
cp.name_680 = true;
|
||||
}
|
||||
var newVel:Number = 0;
|
||||
this.method_668(b1,b2,cp,this._v);
|
||||
var cnormal:name_194 = contact.normal;
|
||||
var sepVel:Number = this._v.x * cnormal.x + this._v.y * cnormal.y + this._v.z * cnormal.z;
|
||||
if(forceInelastic)
|
||||
{
|
||||
minSpeVel = cp.name_678;
|
||||
if(sepVel < minSpeVel)
|
||||
{
|
||||
cp.name_680 = false;
|
||||
}
|
||||
else if(cp.name_680)
|
||||
{
|
||||
return;
|
||||
}
|
||||
newVel = minSpeVel;
|
||||
}
|
||||
else
|
||||
{
|
||||
newVel = cp.name_677;
|
||||
}
|
||||
var deltaVel:Number = newVel - sepVel;
|
||||
var impulse:Number = deltaVel / cp.name_675;
|
||||
var accumImpulse:Number = cp.name_676 + impulse;
|
||||
if(accumImpulse < 0)
|
||||
{
|
||||
accumImpulse = 0;
|
||||
}
|
||||
var deltaImpulse:Number = accumImpulse - cp.name_676;
|
||||
cp.name_676 = accumImpulse;
|
||||
if(b1.var_499)
|
||||
{
|
||||
b1.method_518(cp.r1,normal,deltaImpulse);
|
||||
}
|
||||
if(b2 != null && b2.var_499)
|
||||
{
|
||||
b2.method_518(cp.r2,normal,-deltaImpulse);
|
||||
}
|
||||
this.method_668(b1,b2,cp,this._v);
|
||||
var tanSpeedByUnitImpulse:Number = 0;
|
||||
var dot:Number = this._v.x * cnormal.x + this._v.y * cnormal.y + this._v.z * cnormal.z;
|
||||
this._v.x -= dot * cnormal.x;
|
||||
this._v.y -= dot * cnormal.y;
|
||||
this._v.z -= dot * cnormal.z;
|
||||
var tanSpeed:Number = this._v.length();
|
||||
if(tanSpeed < 0.001)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.var_597.x = -this._v.x;
|
||||
this.var_597.y = -this._v.y;
|
||||
this.var_597.z = -this._v.z;
|
||||
this.var_597.normalize();
|
||||
if(b1.var_499)
|
||||
{
|
||||
r = cp.r1;
|
||||
m = b1.var_495;
|
||||
this._v.x = r.y * this.var_597.z - r.z * this.var_597.y;
|
||||
this._v.y = r.z * this.var_597.x - r.x * this.var_597.z;
|
||||
this._v.z = r.x * this.var_597.y - r.y * this.var_597.x;
|
||||
xx = m.a * this._v.x + m.b * this._v.y + m.c * this._v.z;
|
||||
yy = m.e * this._v.x + m.f * this._v.y + m.g * this._v.z;
|
||||
zz = m.i * this._v.x + m.j * this._v.y + m.k * this._v.z;
|
||||
this._v.x = yy * r.z - zz * r.y;
|
||||
this._v.y = zz * r.x - xx * r.z;
|
||||
this._v.z = xx * r.y - yy * r.x;
|
||||
tanSpeedByUnitImpulse += b1.invMass + this._v.x * this.var_597.x + this._v.y * this.var_597.y + this._v.z * this.var_597.z;
|
||||
}
|
||||
if(b2 != null && b2.var_499)
|
||||
{
|
||||
r = cp.r2;
|
||||
m = b2.var_495;
|
||||
this._v.x = r.y * this.var_597.z - r.z * this.var_597.y;
|
||||
this._v.y = r.z * this.var_597.x - r.x * this.var_597.z;
|
||||
this._v.z = r.x * this.var_597.y - r.y * this.var_597.x;
|
||||
xx = m.a * this._v.x + m.b * this._v.y + m.c * this._v.z;
|
||||
yy = m.e * this._v.x + m.f * this._v.y + m.g * this._v.z;
|
||||
zz = m.i * this._v.x + m.j * this._v.y + m.k * this._v.z;
|
||||
this._v.x = yy * r.z - zz * r.y;
|
||||
this._v.y = zz * r.x - xx * r.z;
|
||||
this._v.z = xx * r.y - yy * r.x;
|
||||
tanSpeedByUnitImpulse += b2.invMass + this._v.x * this.var_597.x + this._v.y * this.var_597.y + this._v.z * this.var_597.z;
|
||||
}
|
||||
var tanImpulse:Number = tanSpeed / tanSpeedByUnitImpulse;
|
||||
var max:Number = contact.name_581 * cp.name_676;
|
||||
if(max < 0)
|
||||
{
|
||||
if(tanImpulse < max)
|
||||
{
|
||||
tanImpulse = max;
|
||||
}
|
||||
}
|
||||
else if(tanImpulse > max)
|
||||
{
|
||||
tanImpulse = max;
|
||||
}
|
||||
if(b1.var_499)
|
||||
{
|
||||
b1.method_518(cp.r1,this.var_597,tanImpulse);
|
||||
}
|
||||
if(b2 != null && b2.var_499)
|
||||
{
|
||||
b2.method_518(cp.r2,this.var_597,-tanImpulse);
|
||||
}
|
||||
}
|
||||
|
||||
private function method_668(body1:name_271, body2:name_271, cp:name_674, result:name_194) : void
|
||||
{
|
||||
var rot:name_194 = body1.state.rotation;
|
||||
var v:name_194 = cp.r1;
|
||||
var x:Number = rot.y * v.z - rot.z * v.y;
|
||||
var y:Number = rot.z * v.x - rot.x * v.z;
|
||||
var z:Number = rot.x * v.y - rot.y * v.x;
|
||||
v = body1.state.velocity;
|
||||
result.x = v.x + x;
|
||||
result.y = v.y + y;
|
||||
result.z = v.z + z;
|
||||
if(body2 != null)
|
||||
{
|
||||
rot = body2.state.rotation;
|
||||
v = cp.r2;
|
||||
x = rot.y * v.z - rot.z * v.y;
|
||||
y = rot.z * v.x - rot.x * v.z;
|
||||
z = rot.x * v.y - rot.y * v.x;
|
||||
v = body2.state.velocity;
|
||||
result.x -= v.x + x;
|
||||
result.y -= v.y + y;
|
||||
result.z -= v.z + z;
|
||||
}
|
||||
}
|
||||
|
||||
private function method_672(dt:Number) : void
|
||||
{
|
||||
for(var item:name_671 = this.name_605.head; item != null; )
|
||||
{
|
||||
item.body.method_510(dt);
|
||||
item = item.next;
|
||||
}
|
||||
}
|
||||
|
||||
private function method_677(dt:Number) : void
|
||||
{
|
||||
var body:name_271 = null;
|
||||
for(var item:name_671 = this.name_605.head; item != null; )
|
||||
{
|
||||
body = item.body;
|
||||
if(body.var_499 && !body.var_501)
|
||||
{
|
||||
body.method_511(dt);
|
||||
}
|
||||
item = item.next;
|
||||
}
|
||||
}
|
||||
|
||||
private function method_674() : void
|
||||
{
|
||||
var body:name_271 = null;
|
||||
for(var item:name_671 = this.name_605.head; item != null; )
|
||||
{
|
||||
body = item.body;
|
||||
body.method_513();
|
||||
body.method_512();
|
||||
if(body.var_502)
|
||||
{
|
||||
if(body.state.velocity.length() < this.var_604 && body.state.rotation.length() < this.var_607)
|
||||
{
|
||||
if(!body.var_501)
|
||||
{
|
||||
++body.var_498;
|
||||
if(body.var_498 >= this.var_606)
|
||||
{
|
||||
body.var_501 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
body.var_498 = 0;
|
||||
body.var_501 = false;
|
||||
}
|
||||
}
|
||||
item = item.next;
|
||||
}
|
||||
}
|
||||
|
||||
public function update(delta:int) : void
|
||||
{
|
||||
++this.var_601;
|
||||
this.time += delta;
|
||||
var dt:Number = 0.001 * delta;
|
||||
this.method_676(dt);
|
||||
this.method_673(dt);
|
||||
this.method_671(dt);
|
||||
this.method_669(dt,false);
|
||||
this.method_672(dt);
|
||||
this.method_669(dt,true);
|
||||
this.method_677(dt);
|
||||
this.method_674();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
57
src/package_92/name_513.as
Normal file
57
src/package_92/name_513.as
Normal file
@@ -0,0 +1,57 @@
|
||||
package package_92
|
||||
{
|
||||
import package_76.name_235;
|
||||
|
||||
public class name_513
|
||||
{
|
||||
private static var poolTop:name_513;
|
||||
|
||||
public var primitive:name_235;
|
||||
|
||||
public var next:name_513;
|
||||
|
||||
public var prev:name_513;
|
||||
|
||||
public function name_513(primitive:name_235)
|
||||
{
|
||||
super();
|
||||
this.primitive = primitive;
|
||||
}
|
||||
|
||||
public static function create(primitive:name_235) : name_513
|
||||
{
|
||||
var item:name_513 = null;
|
||||
if(poolTop == null)
|
||||
{
|
||||
item = new name_513(primitive);
|
||||
}
|
||||
else
|
||||
{
|
||||
item = poolTop;
|
||||
item.primitive = primitive;
|
||||
poolTop = item.next;
|
||||
item.next = null;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
public static function method_712() : void
|
||||
{
|
||||
for(var curr:name_513 = poolTop; curr != null; )
|
||||
{
|
||||
poolTop = curr.next;
|
||||
curr.next = null;
|
||||
curr = poolTop;
|
||||
}
|
||||
}
|
||||
|
||||
public function dispose() : void
|
||||
{
|
||||
this.primitive = null;
|
||||
this.prev = null;
|
||||
this.next = poolTop;
|
||||
poolTop = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
48
src/package_92/name_575.as
Normal file
48
src/package_92/name_575.as
Normal file
@@ -0,0 +1,48 @@
|
||||
package package_92
|
||||
{
|
||||
import package_46.Matrix3;
|
||||
import package_46.name_194;
|
||||
|
||||
public class name_575
|
||||
{
|
||||
public function name_575()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function name_589(mass:Number, halfSize:name_194, result:Matrix3) : void
|
||||
{
|
||||
if(mass <= 0)
|
||||
{
|
||||
throw new ArgumentError();
|
||||
}
|
||||
result.copy(Matrix3.ZERO);
|
||||
if(mass == Infinity)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var xx:Number = halfSize.x * halfSize.x;
|
||||
var yy:Number = halfSize.y * halfSize.y;
|
||||
var zz:Number = halfSize.z * halfSize.z;
|
||||
result.a = 3 / (mass * (yy + zz));
|
||||
result.f = 3 / (mass * (zz + xx));
|
||||
result.k = 3 / (mass * (xx + yy));
|
||||
}
|
||||
|
||||
public static function method_773(mass:Number, r:Number, h:Number, result:Matrix3) : void
|
||||
{
|
||||
if(mass <= 0)
|
||||
{
|
||||
throw new ArgumentError();
|
||||
}
|
||||
result.copy(Matrix3.ZERO);
|
||||
if(mass == Infinity)
|
||||
{
|
||||
return;
|
||||
}
|
||||
result.a = result.f = 1 / (mass * (h * h / 12 + r * r / 4));
|
||||
result.k = 2 / (mass * r * r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
30
src/package_92/name_599.as
Normal file
30
src/package_92/name_599.as
Normal file
@@ -0,0 +1,30 @@
|
||||
package package_92
|
||||
{
|
||||
import package_46.name_194;
|
||||
import package_46.name_566;
|
||||
|
||||
public class name_599
|
||||
{
|
||||
public var position:name_194 = new name_194();
|
||||
|
||||
public var orientation:name_566 = new name_566();
|
||||
|
||||
public var velocity:name_194 = new name_194();
|
||||
|
||||
public var rotation:name_194 = new name_194();
|
||||
|
||||
public function name_599()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function copy(state:name_599) : void
|
||||
{
|
||||
this.position.copy(state.position);
|
||||
this.orientation.copy(state.orientation);
|
||||
this.velocity.copy(state.velocity);
|
||||
this.rotation.copy(state.rotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
15
src/package_92/name_600.as
Normal file
15
src/package_92/name_600.as
Normal file
@@ -0,0 +1,15 @@
|
||||
package package_92
|
||||
{
|
||||
public class name_600
|
||||
{
|
||||
public var name_673:Number = 0;
|
||||
|
||||
public var name_581:Number = 0.3;
|
||||
|
||||
public function name_600()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
90
src/package_92/name_601.as
Normal file
90
src/package_92/name_601.as
Normal file
@@ -0,0 +1,90 @@
|
||||
package package_92
|
||||
{
|
||||
import package_76.name_235;
|
||||
|
||||
public class name_601
|
||||
{
|
||||
public var head:name_513;
|
||||
|
||||
public var tail:name_513;
|
||||
|
||||
public var size:int;
|
||||
|
||||
public function name_601()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function append(primitive:name_235) : void
|
||||
{
|
||||
var item:name_513 = name_513.create(primitive);
|
||||
if(this.head == null)
|
||||
{
|
||||
this.head = this.tail = item;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.tail.next = item;
|
||||
item.prev = this.tail;
|
||||
this.tail = item;
|
||||
}
|
||||
++this.size;
|
||||
}
|
||||
|
||||
public function remove(primitve:name_235) : void
|
||||
{
|
||||
var item:name_513 = this.method_628(primitve);
|
||||
if(item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(item == this.head)
|
||||
{
|
||||
if(this.size == 1)
|
||||
{
|
||||
this.head = this.tail = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.head = item.next;
|
||||
this.head.prev = null;
|
||||
}
|
||||
}
|
||||
else if(item == this.tail)
|
||||
{
|
||||
this.tail = this.tail.prev;
|
||||
this.tail.next = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.prev.next = item.next;
|
||||
item.next.prev = item.prev;
|
||||
}
|
||||
item.dispose();
|
||||
--this.size;
|
||||
}
|
||||
|
||||
public function method_628(primitive:name_235) : name_513
|
||||
{
|
||||
var item:name_513 = this.head;
|
||||
while(item != null && item.primitive != primitive)
|
||||
{
|
||||
item = item.next;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
public function clear() : void
|
||||
{
|
||||
for(var item:name_513 = null; this.head != null; )
|
||||
{
|
||||
item = this.head;
|
||||
this.head = this.head.next;
|
||||
item.dispose();
|
||||
}
|
||||
this.tail = null;
|
||||
this.size = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
43
src/package_92/name_630.as
Normal file
43
src/package_92/name_630.as
Normal file
@@ -0,0 +1,43 @@
|
||||
package package_92
|
||||
{
|
||||
import package_46.name_194;
|
||||
|
||||
public class name_630
|
||||
{
|
||||
public var body1:name_271;
|
||||
|
||||
public var body2:name_271;
|
||||
|
||||
public var name_673:Number;
|
||||
|
||||
public var name_581:Number;
|
||||
|
||||
public var normal:name_194 = new name_194();
|
||||
|
||||
public var points:Vector.<name_674>;
|
||||
|
||||
public var name_679:int;
|
||||
|
||||
public var var_663:Number = 0;
|
||||
|
||||
public var name_680:Boolean;
|
||||
|
||||
public var next:name_630;
|
||||
|
||||
public var index:int;
|
||||
|
||||
private const const_3:int = 8;
|
||||
|
||||
public function name_630(index:int)
|
||||
{
|
||||
this.points = new Vector.<name_674>(this.const_3,true);
|
||||
super();
|
||||
this.index = index;
|
||||
for(var i:int = 0; i < this.const_3; i++)
|
||||
{
|
||||
this.points[i] = new name_674();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
55
src/package_92/name_671.as
Normal file
55
src/package_92/name_671.as
Normal file
@@ -0,0 +1,55 @@
|
||||
package package_92
|
||||
{
|
||||
public class name_671
|
||||
{
|
||||
private static var poolTop:name_671;
|
||||
|
||||
public var body:name_271;
|
||||
|
||||
public var next:name_671;
|
||||
|
||||
public var prev:name_671;
|
||||
|
||||
public function name_671(body:name_271)
|
||||
{
|
||||
super();
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public static function create(body:name_271) : name_671
|
||||
{
|
||||
var item:name_671 = null;
|
||||
if(poolTop == null)
|
||||
{
|
||||
item = new name_671(body);
|
||||
}
|
||||
else
|
||||
{
|
||||
item = poolTop;
|
||||
poolTop = item.next;
|
||||
item.next = null;
|
||||
item.body = body;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
public static function method_712() : void
|
||||
{
|
||||
for(var item:name_671 = poolTop; item != null; )
|
||||
{
|
||||
poolTop = item.next;
|
||||
item.next = null;
|
||||
item = poolTop;
|
||||
}
|
||||
}
|
||||
|
||||
public function dispose() : void
|
||||
{
|
||||
this.body = null;
|
||||
this.prev = null;
|
||||
this.next = poolTop;
|
||||
poolTop = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
49
src/package_92/name_674.as
Normal file
49
src/package_92/name_674.as
Normal file
@@ -0,0 +1,49 @@
|
||||
package package_92
|
||||
{
|
||||
import package_46.name_194;
|
||||
|
||||
public class name_674
|
||||
{
|
||||
public var pos:name_194 = new name_194();
|
||||
|
||||
public var penetration:Number;
|
||||
|
||||
public var feature1:int;
|
||||
|
||||
public var feature2:int;
|
||||
|
||||
public var name_677:Number;
|
||||
|
||||
public var name_678:Number;
|
||||
|
||||
public var name_675:Number;
|
||||
|
||||
public var angularInertia1:Number;
|
||||
|
||||
public var angularInertia2:Number;
|
||||
|
||||
public var r1:name_194 = new name_194();
|
||||
|
||||
public var r2:name_194 = new name_194();
|
||||
|
||||
public var name_676:Number;
|
||||
|
||||
public var name_680:Boolean;
|
||||
|
||||
public function name_674()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function copyFrom(cp:name_674) : void
|
||||
{
|
||||
this.pos.copy(cp.pos);
|
||||
this.penetration = cp.penetration;
|
||||
this.feature1 = cp.feature1;
|
||||
this.feature2 = cp.feature2;
|
||||
this.r1.copy(cp.r1);
|
||||
this.r2.copy(cp.r2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
77
src/package_92/name_681.as
Normal file
77
src/package_92/name_681.as
Normal file
@@ -0,0 +1,77 @@
|
||||
package package_92
|
||||
{
|
||||
public class name_681
|
||||
{
|
||||
public var head:name_671;
|
||||
|
||||
public var tail:name_671;
|
||||
|
||||
public var size:int;
|
||||
|
||||
public function name_681()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function append(body:name_271) : void
|
||||
{
|
||||
var item:name_671 = name_671.create(body);
|
||||
if(this.head == null)
|
||||
{
|
||||
this.head = this.tail = item;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.tail.next = item;
|
||||
item.prev = this.tail;
|
||||
this.tail = item;
|
||||
}
|
||||
++this.size;
|
||||
}
|
||||
|
||||
public function remove(body:name_271) : Boolean
|
||||
{
|
||||
var item:name_671 = this.method_628(body);
|
||||
if(item == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(item == this.head)
|
||||
{
|
||||
if(this.size == 1)
|
||||
{
|
||||
this.head = this.tail = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.head = item.next;
|
||||
this.head.prev = null;
|
||||
}
|
||||
}
|
||||
else if(item == this.tail)
|
||||
{
|
||||
this.tail = item.prev;
|
||||
this.tail.next = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.prev.next = item.next;
|
||||
item.next.prev = item.prev;
|
||||
}
|
||||
item.dispose();
|
||||
--this.size;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function method_628(body:name_271) : name_671
|
||||
{
|
||||
var item:name_671 = this.head;
|
||||
while(item != null && item.body != body)
|
||||
{
|
||||
item = item.next;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user