Browse Source

Update RayHelper to Mesh in Physics loop and make renderLine not pickable (#8703)

regnaio 5 years ago
parent
commit
6838fbcc23
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/Debug/rayHelper.ts

+ 2 - 0
src/Debug/rayHelper.ts

@@ -72,6 +72,7 @@ export class RayHelper {
             this._scene = scene;
             this._scene = scene;
             this._renderPoints = [ray.origin, ray.origin.add(ray.direction.scale(ray.length))];
             this._renderPoints = [ray.origin, ray.origin.add(ray.direction.scale(ray.length))];
             this._renderLine = Mesh.CreateLines("ray", this._renderPoints, scene, true);
             this._renderLine = Mesh.CreateLines("ray", this._renderPoints, scene, true);
+            this._renderLine.isPickable = false;
 
 
             if (this._renderFunction) {
             if (this._renderFunction) {
                 this._scene.registerBeforeRender(this._renderFunction);
                 this._scene.registerBeforeRender(this._renderFunction);
@@ -171,6 +172,7 @@ export class RayHelper {
         if (!this._updateToMeshFunction) {
         if (!this._updateToMeshFunction) {
             this._updateToMeshFunction = (<() => void>this._updateToMesh.bind(this));
             this._updateToMeshFunction = (<() => void>this._updateToMesh.bind(this));
             this._attachedToMesh.getScene().registerBeforeRender(this._updateToMeshFunction);
             this._attachedToMesh.getScene().registerBeforeRender(this._updateToMeshFunction);
+            this._attachedToMesh.getScene().onAfterStepObservable.add(this._updateToMeshFunction);
         }
         }
 
 
         // force world matrix computation before the first ray helper computation
         // force world matrix computation before the first ray helper computation