2013-06-26 04:44:56 +00:00
|
|
|
/// <reference path="../../math/Vec2.ts" />
|
|
|
|
/// <reference path="../../math/Vec2Utils.ts" />
|
2013-08-01 21:21:03 +00:00
|
|
|
/// <reference path="../AdvancedPhysics.ts" />
|
2013-06-14 16:55:07 +00:00
|
|
|
/// <reference path="../Body.ts" />
|
|
|
|
/// <reference path="../Bounds.ts" />
|
2013-06-14 14:18:41 +00:00
|
|
|
/// <reference path="IShape.ts" />
|
2013-06-13 16:15:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Phaser - Advanced Physics - Shape
|
|
|
|
*
|
|
|
|
* Based on the work Ju Hyung Lee started in JS PhyRus.
|
|
|
|
*/
|
|
|
|
|
2013-06-26 04:44:56 +00:00
|
|
|
module Phaser.Physics {
|
2013-06-13 16:15:16 +00:00
|
|
|
|
|
|
|
export class Shape {
|
|
|
|
|
|
|
|
constructor(type: number) {
|
|
|
|
|
2013-08-01 21:21:03 +00:00
|
|
|
this.id = AdvancedPhysics.shapeCounter++;
|
2013-06-13 16:15:16 +00:00
|
|
|
this.type = type;
|
|
|
|
|
|
|
|
this.elasticity = 0.0;
|
|
|
|
this.friction = 1.0;
|
|
|
|
this.density = 1;
|
|
|
|
|
2013-06-14 03:13:00 +00:00
|
|
|
this.bounds = new Bounds;
|
2013-06-13 16:15:16 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public id: number;
|
|
|
|
public type: number;
|
2013-06-14 14:18:41 +00:00
|
|
|
public body: Body;
|
2013-06-13 16:15:16 +00:00
|
|
|
|
2013-06-21 22:39:29 +00:00
|
|
|
public verts: Phaser.Vec2[];
|
2013-06-26 04:44:56 +00:00
|
|
|
public planes: Phaser.Physics.Plane[];
|
2013-06-21 22:39:29 +00:00
|
|
|
|
|
|
|
public tverts: Phaser.Vec2[];
|
2013-06-26 04:44:56 +00:00
|
|
|
public tplanes: Phaser.Physics.Plane[];
|
2013-06-21 22:39:29 +00:00
|
|
|
|
|
|
|
public convexity: bool;
|
|
|
|
|
2013-06-13 16:15:16 +00:00
|
|
|
// Coefficient of restitution (elasticity)
|
|
|
|
public elasticity: number;
|
|
|
|
|
|
|
|
// Frictional coefficient
|
|
|
|
public friction: number;
|
|
|
|
|
|
|
|
// Mass density
|
|
|
|
public density: number;
|
|
|
|
|
|
|
|
// Axis-aligned bounding box
|
2013-06-14 03:13:00 +00:00
|
|
|
public bounds: Bounds;
|
2013-06-13 16:15:16 +00:00
|
|
|
|
2013-06-14 14:18:41 +00:00
|
|
|
// Over-ridden by ShapePoly
|
|
|
|
public findEdgeByPoint(p: Phaser.Vec2, minDist: number): number {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2013-06-13 16:15:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|