Преглед изворни кода

Ammo.js Capsule Shape Impostor Support

Added PhysicsImpostor.CapsuleImpostor with Ammo.btCapsuleShape in AmmoJsPlugin
MackeyK24 пре 6 година
родитељ
комит
f1e3754861

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

@@ -47,7 +47,8 @@
 
 
 ### Physics
 ### Physics
 - Update Ammo.js library to support global collision contact callbacks ([MackeyK24](https://github.com/MackeyK24/))
 - Update Ammo.js library to support global collision contact callbacks ([MackeyK24](https://github.com/MackeyK24/))
-- Update AmmoJSPlugin to allow your own broadphase overlapping pair cache ([MackeyK24](https://github.com/MackeyK24/))
+- Update Ammo.js library to allow native capsule shape impostors ([MackeyK24](https://github.com/MackeyK24/))
+- Update Ammo.js library to allow your own broadphase overlapping pair cache ([MackeyK24](https://github.com/MackeyK24/))
 - Update Ammo.js library and AmmoJS plugin to support ellipsoid ([CedricGuillemet](https://github.com/CedricGuillemet/))
 - Update Ammo.js library and AmmoJS plugin to support ellipsoid ([CedricGuillemet](https://github.com/CedricGuillemet/))
 
 
 ### Loaders
 ### Loaders

+ 3 - 0
src/Physics/Plugins/ammoJSPlugin.ts

@@ -912,6 +912,9 @@ export class AmmoJSPlugin implements IPhysicsEnginePlugin {
                     returnValue.setLocalScaling(new Ammo.btVector3(extendSize.x / 2, extendSize.y / 2, extendSize.z / 2));
                     returnValue.setLocalScaling(new Ammo.btVector3(extendSize.x / 2, extendSize.y / 2, extendSize.z / 2));
                 }
                 }
                 break;
                 break;
+            case PhysicsImpostor.CapsuleImpostor:
+                returnValue = new Ammo.btCapsuleShape(extendSize.x / 2, extendSize.y / 2);
+                break;
             case PhysicsImpostor.CylinderImpostor:
             case PhysicsImpostor.CylinderImpostor:
                 this._tmpAmmoVectorA.setValue(extendSize.x / 2, extendSize.y / 2, extendSize.z / 2);
                 this._tmpAmmoVectorA.setValue(extendSize.x / 2, extendSize.y / 2, extendSize.z / 2);
                 returnValue = new Ammo.btCylinderShape(this._tmpAmmoVectorA);
                 returnValue = new Ammo.btCylinderShape(this._tmpAmmoVectorA);

+ 4 - 0
src/Physics/physicsImpostor.ts

@@ -1239,6 +1239,10 @@ export class PhysicsImpostor {
      */
      */
     public static MeshImpostor = 4;
     public static MeshImpostor = 4;
     /**
     /**
+     * Capsule-Impostor type (Ammo.js plugin only)
+     */
+    public static CapsuleImpostor = 6;
+    /**
      * Cylinder-Imposter type
      * Cylinder-Imposter type
      */
      */
     public static CylinderImpostor = 7;
     public static CylinderImpostor = 7;