2013-06-14 16:55:07 +00:00
|
|
|
/// <reference path="../../../math/Vec2.ts" />
|
|
|
|
/// <reference path="../../../math/Vec2Utils.ts" />
|
|
|
|
/// <reference path="../Manager.ts" />
|
|
|
|
/// <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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
module Phaser.Physics.Advanced {
|
|
|
|
|
|
|
|
export class Shape {
|
|
|
|
|
|
|
|
constructor(type: number) {
|
|
|
|
|
|
|
|
this.id = Phaser.Physics.Advanced.Manager.shapeCounter++;
|
|
|
|
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[];
|
|
|
|
public planes: Phaser.Physics.Advanced.Plane[];
|
|
|
|
|
|
|
|
public tverts: Phaser.Vec2[];
|
|
|
|
public tplanes: Phaser.Physics.Advanced.Plane[];
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
}
|