|
@@ -100188,6 +100188,25 @@ var BABYLON;
|
|
}
|
|
}
|
|
var joint;
|
|
var joint;
|
|
switch (impostorJoint.joint.type) {
|
|
switch (impostorJoint.joint.type) {
|
|
|
|
+ case BABYLON.PhysicsJoint.DistanceJoint:
|
|
|
|
+ var distance = jointData.maxDistance;
|
|
|
|
+ if (distance) {
|
|
|
|
+ jointData.mainPivot = new BABYLON.Vector3(0, -distance / 2, 0);
|
|
|
|
+ jointData.connectedPivot = new BABYLON.Vector3(0, distance / 2, 0);
|
|
|
|
+ }
|
|
|
|
+ joint = new Ammo.btPoint2PointConstraint(mainBody, connectedBody, new Ammo.btVector3(jointData.mainPivot.x, jointData.mainPivot.y, jointData.mainPivot.z), new Ammo.btVector3(jointData.connectedPivot.x, jointData.connectedPivot.y, jointData.connectedPivot.z));
|
|
|
|
+ break;
|
|
|
|
+ case BABYLON.PhysicsJoint.HingeJoint:
|
|
|
|
+ if (!jointData.mainAxis) {
|
|
|
|
+ jointData.mainAxis = new BABYLON.Vector3(0, 0, 0);
|
|
|
|
+ }
|
|
|
|
+ if (!jointData.connectedAxis) {
|
|
|
|
+ jointData.connectedAxis = new BABYLON.Vector3(0, 0, 0);
|
|
|
|
+ }
|
|
|
|
+ var mainAxis = new Ammo.btVector3(jointData.mainAxis.x, jointData.mainAxis.y, jointData.mainAxis.z);
|
|
|
|
+ var connectedAxis = new Ammo.btVector3(jointData.connectedAxis.x, jointData.connectedAxis.y, jointData.connectedAxis.z);
|
|
|
|
+ joint = new Ammo.btHingeConstraint(mainBody, connectedBody, new Ammo.btVector3(jointData.mainPivot.x, jointData.mainPivot.y, jointData.mainPivot.z), new Ammo.btVector3(jointData.connectedPivot.x, jointData.connectedPivot.y, jointData.connectedPivot.z), mainAxis, connectedAxis);
|
|
|
|
+ break;
|
|
case BABYLON.PhysicsJoint.BallAndSocketJoint:
|
|
case BABYLON.PhysicsJoint.BallAndSocketJoint:
|
|
joint = new Ammo.btPoint2PointConstraint(mainBody, connectedBody, new Ammo.btVector3(jointData.mainPivot.x, jointData.mainPivot.y, jointData.mainPivot.z), new Ammo.btVector3(jointData.connectedPivot.x, jointData.connectedPivot.y, jointData.connectedPivot.z));
|
|
joint = new Ammo.btPoint2PointConstraint(mainBody, connectedBody, new Ammo.btVector3(jointData.mainPivot.x, jointData.mainPivot.y, jointData.mainPivot.z), new Ammo.btVector3(jointData.connectedPivot.x, jointData.connectedPivot.y, jointData.connectedPivot.z));
|
|
break;
|
|
break;
|
|
@@ -100510,7 +100529,7 @@ var BABYLON;
|
|
* @param motorIndex index of the motor
|
|
* @param motorIndex index of the motor
|
|
*/
|
|
*/
|
|
AmmoJSPlugin.prototype.setMotor = function (joint, speed, maxForce, motorIndex) {
|
|
AmmoJSPlugin.prototype.setMotor = function (joint, speed, maxForce, motorIndex) {
|
|
- BABYLON.Tools.Warn("setMotor is not currently supported by the Ammo physics plugin");
|
|
|
|
|
|
+ joint.physicsJoint.enableAngularMotor(true, speed, maxForce);
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Sets the motors limit
|
|
* Sets the motors limit
|