|
@@ -900,7 +900,16 @@ export class AmmoJSPlugin implements IPhysicsEnginePlugin {
|
|
|
|
|
|
switch (impostor.type) {
|
|
switch (impostor.type) {
|
|
case PhysicsImpostor.SphereImpostor:
|
|
case PhysicsImpostor.SphereImpostor:
|
|
- returnValue = new Ammo.btSphereShape(extendSize.x / 2);
|
|
|
|
|
|
+ // Is there a better way to compare floats number? With an epsylon or with a Math function
|
|
|
|
+ if (extendSize.x == extendSize.y && extendSize.x == extendSize.z) {
|
|
|
|
+ returnValue = new Ammo.btSphereShape(extendSize.x / 2);
|
|
|
|
+ } else {
|
|
|
|
+ // create a btMultiSphereShape because it's not possible to set a local scaling on a btSphereShape
|
|
|
|
+ var positions = [new Ammo.btVector3(0,0,0)];
|
|
|
|
+ var radii = [1];
|
|
|
|
+ returnValue = new Ammo.btMultiSphereShape(positions, radii, 1);
|
|
|
|
+ returnValue.setLocalScaling(new Ammo.btVector3(extendSize.x / 2, extendSize.y / 2, extendSize.z / 2));
|
|
|
|
+ }
|
|
break;
|
|
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);
|