Jump to content

ArcRotateCamera checkCollisions set to true locks up camera


JLHolmes
 Share

Recommended Posts

Hey guys... it's been a while, but things have been going pretty smooth with BJS.

That is, until I upgraded to 3.0. My scene just up an disappeared! Digging into it, I found that it was when I set checkCollisions to true, the scene for that camera would just lock up the camera.... unable to move it at all.

So....

sceneState.camera = new BABYLON.ArcRotateCamera("ArcRotateCamera", 0, 0.8, 1000, new BABYLON.Vector3(0,0,0), sceneState.scene);
sceneState.camera.speed = 5;
sceneState.camera.checkCollisions = true;
sceneState.camera.ellipsoid = new BABYLON.Vector3(2, 5, 2);
sceneState.camera.upperBetaLimit = Math.PI/2;
sceneState.camera.wheelPrecision = .1;
sceneState.camera.lowerRadiusLimit = sceneState.togScene.gridSize * 2;

Fails... but...

sceneState.camera = new BABYLON.ArcRotateCamera("ArcRotateCamera", 0, 0.8, 1000, new BABYLON.Vector3(0,0,0), sceneState.scene);
sceneState.camera.speed = 5;
sceneState.camera.upperBetaLimit = Math.PI/2;
sceneState.camera.wheelPrecision = .1;
sceneState.camera.lowerRadiusLimit = sceneState.togScene.gridSize * 2;

... is just fine.

Thoughts? Did I miss some other setting or change with regard to moving to 3.0? (Actually, v3.1-alpha)

Link to comment
Share on other sites

I'm trying to repo it in the playground... it does not seem to happen in simple scenes... only when there's an object much larger than the camera's radius.

How do I determine what type of collision is being used? Well... since I have not done anything special to pull in collision I assume I'm using native.

Link to comment
Share on other sites

Hi guys... sorry to interrupt.  JLH... are you using a ground?  Is the ground set .checkCollisions = true?  Was the ground created with .createGroundFromHeightMap?

(thx)

I did a little experimenting... http://playground.babylonjs.com/#NAM2N8#1

I am unable to reproduce the stuck camera symptom, so far.  JLH's camera settings are in lines 55-61. 

I added two badly-Wingnut-coded funcs at the top... that I have used for other projects... .showEllipsoid() and .setEllipsoidPerBoundingBox().

After activating them in the lines 88/89, I realized they were failing...  particularly the .refreshBoundingInfo() in line 6.

Anyway, I learned very little... still testing... but in this version, line 98 reports (-infinity, -infinity,-infinity) and that concerns me. 

Activating line 91 is still causing errors, unless I ALSO activate line 90.  hmm.

Code:  https://github.com/BabylonJS/Babylon.js/blob/master/src/Mesh/babylon.mesh.ts#L622

That's all I have.  I can understand why .checkCollisions = true on a heightMap ground... might NOT use a standard mesh.ellipsoid.  FreeCams with .applyGravity would act very strange if an .ellipsoid was used as a heightMap collider.  FreeCams would never fall-to the ground in valleys between mountains.... because the .ellipsoid would span across the valley, mountain to mountain.

Just testing, testing, testing, seeing what I can discover.  Fellow forum helpers... join-in freely with comments and more playground tests.  thx.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...