Sign in to follow this  
ian

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 ?

 

 

greetings

Ian

 

Share this post


Link to post
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!  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.