|
@@ -378,12 +378,16 @@ export class AmmoJSPlugin implements IPhysicsEnginePlugin {
|
|
|
var worldPoint = this._tmpAmmoVectorA;
|
|
|
var impulse = this._tmpAmmoVectorB;
|
|
|
|
|
|
+ worldPoint.setValue(contactPoint.x, contactPoint.y, contactPoint.z);
|
|
|
+
|
|
|
// Convert contactPoint relative to center of mass
|
|
|
if (impostor.object && impostor.object.getWorldMatrix) {
|
|
|
- contactPoint.subtractInPlace(impostor.object.getWorldMatrix().getTranslation());
|
|
|
+ var localTranslation = impostor.object.getWorldMatrix().getTranslation();
|
|
|
+ worldPoint.x -= localTranslation.x;
|
|
|
+ worldPoint.y -= localTranslation.y;
|
|
|
+ worldPoint.z -= localTranslation.z;
|
|
|
}
|
|
|
|
|
|
- worldPoint.setValue(contactPoint.x, contactPoint.y, contactPoint.z);
|
|
|
impulse.setValue(force.x, force.y, force.z);
|
|
|
|
|
|
impostor.physicsBody.applyForce(impulse, worldPoint);
|