Jump to content

Misunderstand box1.checkCollisions ???


Recommended Posts

if we set  box1.physicsImpostor do we still have to set box1.checkCollisions = true; or can we remove box1.checkCollisions = true; from code?

why we need .checkCollisions = true?

Is not box1.physicsImpostor enought to do in code?

Why/When we must do .checkCollisions = true for colliders?

How .checkCollisions = true actualy works in babylonjs engine ?






Link to comment
Share on other sites

Hi Ian.  For physics engines, .checkCollisions NOT needed.  It is for built-into-BJS .ellipsoid-based colliders (on cameras) and also for mesh (for .moveWithCollisions() ) .

SOME confusion happened... because of FIRST BJS physics demo.  http://www.babylonjs.com/demos/physics/

In there, walls and floor are set .checkCollisions = true.  BUT... it is used on floor because camera.applyGravity = true; (keeps camera on the floor).  It is used on walls... to keep camera from escaping the play area. 

Somehow, years later, some people are using .checkCollisions = true   ...unnecessarily ...in their physics engine scenes.  :)

It is one of the MANY FUN things that happened in the history of BabylonJS.  I have remarked-out HUNDREDS of .checkCollisions = true; in forum users' physics playgrounds.  :D

It makes me smile each time.  People always think "Oh, mesh.checkCollisions = true sounds like a good thing for physicsEngine."  But no, it is for simple BJS built-in collider system and .moveWithCollisions.  :)  Hope this helps.  Could you please add checkCollisions, applyGravity, and moveWithCollisions ...to the tags of your first post, Ian?  That would be great.  Thanks!  Add 'solved', too, if you are satisfied with answer.  :)

Oh, DK won race-to-answer!  Darnit!  :)

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...