Browse Source

Merge pull request #5819 from TrevorDev/oimoDefaultForce

oimo default force
David Catuhe 6 years ago
parent
commit
0c364b602e
2 changed files with 7 additions and 5 deletions
  1. 1 1
      dist/preview release/what's new.md
  2. 6 4
      src/Physics/Plugins/oimoJSPlugin.ts

+ 1 - 1
dist/preview release/what's new.md

@@ -157,7 +157,7 @@
 - Fix more case sensitive paths ([mrdunk](https://github.com))
 - Attaching a BoundingBoxGizmo on a child should not remove its parent ([TrevorDev](https://github.com/TrevorDev)))
 - AmmoJS fix include issue caused after modules update and use world contact point to be consistent with oimo and cannon ([TrevorDev](https://github.com/TrevorDev)))
-- Warn of motor with maxForce in Oimo, cannonJS support no impostor, cannonJS cylinder axis, ammoJS wake up impostor when apply force/impulse ([TrevorDev](https://github.com/TrevorDev)))
+- Warn of motor with maxForce in Oimo and set default force to be consistent with others, cannonJS support no impostor, cannonJS cylinder axis, ammoJS wake up impostor when apply force/impulse ([TrevorDev](https://github.com/TrevorDev)))
 - Utility layer should render on last active camera ([TrevorDev](https://github.com/TrevorDev))
 - PointerDragBehavior should not let the drag plane get out of sync when rotating the object during dragging ([TrevorDev](https://github.com/TrevorDev))
 - Do not crash the application if webVR submitFrame fails ([TrevorDev](https://github.com/TrevorDev))

+ 6 - 4
src/Physics/Plugins/oimoJSPlugin.ts

@@ -422,16 +422,18 @@ export class OimoJSPlugin implements IPhysicsEnginePlugin {
         }
     }
 
-    public setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number) {
-        if (maxForce !== undefined) {
-            Logger.Warn("OimoJS plugin currently has unexpected behavior when using setMotor with maxForce parameter");
+    public setMotor(joint: IMotorEnabledJoint, speed: number, force?: number, motorIndex?: number) {
+        if (force !== undefined) {
+            Logger.Warn("OimoJS plugin currently has unexpected behavior when using setMotor with force parameter");
+        }else {
+            force = 1e6;
         }
         speed *= -1;
 
         //TODO separate rotational and transational motors.
         var motor = motorIndex ? joint.physicsJoint.rotationalLimitMotor2 : joint.physicsJoint.rotationalLimitMotor1 || joint.physicsJoint.rotationalLimitMotor || joint.physicsJoint.limitMotor;
         if (motor) {
-            motor.setMotor(speed, maxForce);
+            motor.setMotor(speed, force);
         }
     }