2017-06-24 02:42:28 +02:00
|
|
|
/**
|
|
|
|
* Shape Superset - The apiShape properties get moved into the Shape object itself, and then the instance is created
|
|
|
|
* @param physics
|
|
|
|
* @param apiShape GameLib.D3.API.Shape
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
GameLib.D3.Shape.Plane = function (
|
|
|
|
physics,
|
|
|
|
apiShape
|
|
|
|
) {
|
|
|
|
this.physics = physics;
|
|
|
|
this.physics.isNotCannonThrow();
|
|
|
|
|
2017-12-04 13:23:15 +01:00
|
|
|
if (GameLib.Utils.UndefinedOrNull(apiShape)) {
|
|
|
|
apiShape = {
|
|
|
|
shapeType : GameLib.D3.API.Shape.SHAPE_TYPE_PLANE
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
if (apiShape instanceof GameLib.D3.Shape.Plane) {
|
|
|
|
return apiShape;
|
|
|
|
}
|
|
|
|
|
2017-06-24 02:42:28 +02:00
|
|
|
GameLib.D3.Shape.call(
|
|
|
|
this,
|
|
|
|
this.physics,
|
|
|
|
apiShape
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
GameLib.D3.Shape.Plane.prototype = Object.create(GameLib.D3.Shape.prototype);
|
|
|
|
GameLib.D3.Shape.Plane.prototype.constructor = GameLib.D3.Shape.Plane;
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @returns {GameLib.D3.Shape.Plane|*|SEA3D.Plane}
|
|
|
|
*/
|
|
|
|
GameLib.D3.Shape.Plane.prototype.createInstance = function() {
|
2017-10-23 14:52:35 +02:00
|
|
|
/**
|
|
|
|
* A plane is just a plane at z = 0, to rotate it put it inside a rigid body and rotate the body
|
|
|
|
*/
|
|
|
|
this.instance = new CANNON.Plane();
|
|
|
|
GameLib.D3.Shape.prototype.createInstance.call(this);
|
2017-06-24 02:42:28 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
GameLib.D3.Shape.Plane.prototype.updateInstance = function() {
|
2017-09-12 21:09:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
GameLib.D3.Shape.Plane.FromObject = function(physics, objectShape) {
|
|
|
|
|
|
|
|
var apiShape = GameLib.D3.API.Shape.FromObject(objectShape);
|
|
|
|
|
|
|
|
return new GameLib.D3.Shape.Plane(
|
|
|
|
physics,
|
|
|
|
apiShape
|
|
|
|
);
|
2017-06-24 02:42:28 +02:00
|
|
|
};
|