mind0n Posted October 13, 2018 Share Posted October 13, 2018 Refer to the link below, for billboard enabled meshes, I added mouse pick event so the camera will target to the mesh which being clicked. However, after click on the mesh which BILLBOARDMODE_ALL is enabled, I got the following error. I'd be really appreciated if anyone can fix this issue. Thanks. https://www.babylonjs-playground.com/#9XBPW4#2 Quote 38babylon.js:1 Uncaught RangeError: Maximum call stack size exceeded at m.h.computeWorldMatrix (babylon.js:1) at m.h.getAbsolutePosition (babylon.js:1) at n._getTargetPosition (babylon.js:1) at n._isSynchronizedViewMatrix (babylon.js:1) at n.c.getViewMatrix (babylon.js:1) at m.h.computeWorldMatrix (babylon.js:1) at m.h.getAbsolutePosition (babylon.js:1) at n._getTargetPosition (babylon.js:1) at n._isSynchronizedViewMatrix (babylon.js:1) at n.c.getViewMatrix (babylon.js:1) if (!m.actionManager){ m.actionManager = new BABYLON.ActionManager(scene); } var act = new BABYLON.ExecuteCodeAction( BABYLON.ActionManager.OnPickTrigger, pick ); m.actionManager.registerAction(act); function pick(evt){ var mesh = evt.meshUnderPointer; camera.setTarget(mesh); } nazimboudeffa 1 Quote Link to comment Share on other sites More sharing options...
ssaket Posted October 13, 2018 Share Posted October 13, 2018 It's because of never ending recursive calls between (could be because of something else too)- Mesh.TransformNode.computeWorldMatrix -> ArcRotateCamera._getTargetPosition -> Mesh.TransformNode.getAbsolutePosition though I don't know how to solve it It's like mesh and camera asking each other's world coordinates. dead lock !! lol ! Quote Link to comment Share on other sites More sharing options...
mind0n Posted October 14, 2018 Author Share Posted October 14, 2018 17 hours ago, ssaket said: It's because of never ending recursive calls between (could be because of something else too)- Mesh.TransformNode.computeWorldMatrix -> ArcRotateCamera._getTargetPosition -> Mesh.TransformNode.getAbsolutePosition though I don't know how to solve it It's like mesh and camera asking each other's world coordinates. dead lock !! lol ! Hi @ssaket or @Deltakosh, I understand that this is a complicated problem. So I adjusted the code to narrow down the problem. Refer to the link below, the problem will only occur when billboardMode = BABYLON.Mesh.BILLBOARDMODE_ALL. For BILLBOARDMODE_X, BILLBOARDMODE_Y or BILLBOARDMODE_Z, this issue never occurs. And now just one click of the mesh will trigger the issue. Hope this helps. https://www.babylonjs-playground.com/#9XBPW4#2 Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted October 14, 2018 Share Posted October 14, 2018 Hi Deltakosh should be around by tomorrow. As mentioned, this happens because of a loop in calls, Here's a temporary fix for until it's fixed; Accessing absolutePosition directly, instead of getAbsolutePosition() function which forces computeWorldMatrix. Include the snippet in your code, after the main babylonJs file. BABYLON.ArcRotateCamera.prototype._getTargetPosition = function() { if (this._targetHost && this._targetHost.absolutePosition) { var e = this._targetHost.absolutePosition; this._targetBoundingCenter ? e.addToRef(this._targetBoundingCenter, this._target) : this._target.copyFrom(e) } var t = this._getLockedTargetPosition(); return t || this._target } https://www.babylonjs-playground.com/#9XBPW4#4 mind0n and ssaket 2 Quote Link to comment Share on other sites More sharing options...
mind0n Posted October 15, 2018 Author Share Posted October 15, 2018 19 hours ago, aWeirdo said: Hi Deltakosh should be around by tomorrow. As mentioned, this happens because of a loop in calls, Here's a temporary fix for until it's fixed; Accessing absolutePosition directly, instead of getAbsolutePosition() function which forces computeWorldMatrix. Include the snippet in your code, after the main babylonJs file. BABYLON.ArcRotateCamera.prototype._getTargetPosition = function() { if (this._targetHost && this._targetHost.absolutePosition) { var e = this._targetHost.absolutePosition; this._targetBoundingCenter ? e.addToRef(this._targetBoundingCenter, this._target) : this._target.copyFrom(e) } var t = this._getLockedTargetPosition(); return t || this._target } https://www.babylonjs-playground.com/#9XBPW4#4 Thank you so much! Quote Link to comment Share on other sites More sharing options...
Guest Posted October 15, 2018 Share Posted October 15, 2018 And it will be fix in a couple of minutes Thanks team! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.