Jump to content

displacement material messes up collision


Recommended Posts

Hi guys.  I did some experimenting:  https://www.babylonjs-playground.com/#5CT9MA#1

Let's see... I added two functions to Mesh class... .setEllipsoidPerBoundingBox() and .showEllipsoid().. up at the top of the PG.

I made sure camera.checkCollisions = true was set in line 45.  I did the same for Polyhedron... in line 160.

I stopped at lines 161/162 and thought about them.  :)

Lines 165-168... manually set a boundingBox size that surrounded the mesh... by trial and error.

Lines 171-172... called my two custom functions.  They appear to work... but are experimental and subject to bugs.

Lines 174-179... did a bunch of dumps to console... where I realized that camera had no ._collider, so I added one.  Used code from https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/babylon.freeCamera.ts#L150 as example.

Result:  Nothing changed.  Total failure.  No sign of camera-to-Polyhedron colliding at all.  hrmf!   What the heck?!   I'll keep testing and thinking. 

I'm currently using Firefox ESR (which is a 52.6.0 non-Quantum, so plugins still work.)  I advise ALL to use Firefox ESR instead of v57+.  I think ESR will be supported for at least a year, and that gives the (ad blocker) plugin authors... time to convert their plugins to "webExtensions API".  Trying to use almost ANY firefox plugin... with Firefox 58... will cause playground, webGL scenes, and the BJS forum website... to fail... and with nearly ZERO indications of WHY.  Be careful.  It made me pretty scared and aggravated... 2 days ago.

Link to comment
Share on other sites


@waverider ask any thing more about this  

i am not optimize this pick system yet and don't make it like tools for BJS

but that have some benefits

1. you can detect any pixel of mesh  no need separate or  make more

2. that is not important how much complicated geometry you have or heavy vertex that is 

3. you can use parallel camera with different directions in each frame

(i test one time 32 x 32 camera for medium graphic card you can see how that implemented  

4. you can ignore some pixel of mesh by 'discard' 

5. you can detect back face when that back face is enabled 


and have some problem too like

1. that is very new technic for pick so you don't have so much tools in BJS for config that easily

2. just detect One mesh in each ray 

3. we have not  face information   

4. not optimization for yet

5. not have any more information like distance or 3d position  or normal or ... (maybe we can have it in in future )


i recommend that for all system with good graphic card ( if you write a project for Game )




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.

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.


  • Recently Browsing   0 members

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