Просмотр исходного кода

exposed collisionr retry count

Cedric Guillemet 4 лет назад
Родитель
Сommit
95ab3e2488
2 измененных файлов с 4 добавлено и 1 удалено
  1. 1 0
      dist/preview release/what's new.md
  2. 3 1
      src/Meshes/abstractMesh.ts

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

@@ -14,6 +14,7 @@
 - Added support for infinite perspective cameras ([Deltakosh](https://github.com/deltakosh))
 - Added ability to enable/disable ArcRotateCamera zoom on multiTouch event ([NicolasBuecher](https://github.com/NicolasBuecher))
 - Moving button to shared uI folder.([msDestiny14](https://github.com/msDestiny14))
+- Added `collisionRetryCount` to improved collision detection ([CedricGuillemet](https://github.com/CedricGuillemet))
 - Moved sharedUI component to shared UI folder. ([msDestiny14](https://github.com/msDestiny14))
 - Added encapsulate and encapsulateBoundingInfo methods to BoundingInfo. ([Tolo789](https://github.com/Tolo789))
 - Added onLoadObservable to the textureDome class(es) ([RaananW](https://github.com/RaananW))

+ 3 - 1
src/Meshes/abstractMesh.ts

@@ -501,6 +501,8 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
     public useOctreeForPicking = true;
     /** Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes collision (true by default) */
     public useOctreeForCollisions = true;
+    /** number of collision detection tries. Change this value if not all colisions are detected and handled properly. */
+    public collisionRetryCount: number = 3;
 
     /**
      * Gets or sets the current layer mask (default is 0x0FFFFFFF)
@@ -1458,7 +1460,7 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
 
         this._meshCollisionData._collider._radius = this.ellipsoid;
 
-        coordinator.getNewPosition(this._meshCollisionData._oldPositionForCollisions, displacement, this._meshCollisionData._collider, 3, this, this._onCollisionPositionChange, this.uniqueId);
+        coordinator.getNewPosition(this._meshCollisionData._oldPositionForCollisions, displacement, this._meshCollisionData._collider, this.collisionRetryCount, this, this._onCollisionPositionChange, this.uniqueId);
         return this;
     }