r3-legacy/src/r3-d3-shape-plane.js

53 lines
1.2 KiB
JavaScript

/**
* Shape Superset - The apiShape properties get moved into the Shape object itself, and then the instance is created
* @param physics
* @param apiShape R3.D3.API.Shape
* @constructor
*/
R3.D3.Shape.Plane = function (
physics,
apiShape
) {
this.physics = physics;
this.physics.isNotCannonThrow();
if (R3.Utils.UndefinedOrNull(apiShape)) {
apiShape = {
shapeType : R3.D3.API.Shape.SHAPE_TYPE_PLANE
};
}
R3.D3.Shape.call(
this,
this.physics,
apiShape
);
};
R3.D3.Shape.Plane.prototype = Object.create(R3.D3.Shape.prototype);
R3.D3.Shape.Plane.prototype.constructor = R3.D3.Shape.Plane;
/**
*
* @returns {R3.D3.Shape.Plane|*|SEA3D.Plane}
*/
R3.D3.Shape.Plane.prototype.createInstance = function() {
/**
* 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();
R3.D3.Shape.prototype.createInstance.call(this);
};
R3.D3.Shape.Plane.prototype.updateInstance = function() {
};
R3.D3.Shape.Plane.FromObject = function(physics, objectShape) {
var apiShape = R3.D3.API.Shape.FromObject(objectShape);
return new R3.D3.Shape.Plane(
physics,
apiShape
);
};