Jump to content

Assigning collision detection on imported meshes


larsiii23
 Share

Recommended Posts

Hi!

 

I'm currently working with a project where I decided to use babylon.js, and is a newbie on the framework.

 

I have imported a BIM-model which consists of hundred of meshes into babylon, and wondered if there is a way to check collisions for all these meshes without have to get each mesh by name,

var mesh = getMeshByName("meshName");

 and then assign it

mesh.checkCollisions = true;

Is there a way to loop through all the importet meshes without getting them by name?

Link to comment
Share on other sites

Thanks. Exactly the solution i was hoping for  :)

 

I implemented the checkCollisons in the callback, like this:

BABYLON.SceneLoader.ImportMesh("", "", "1932.babylon", scene, function (newMeshes, particleSystems, skeletons){for(var i=0; i<scene.meshes.length; i++)    scene.meshes[i].checkCollisions=true;});

After this change I feel the "game" got more laggy however. Is there a better (performance enhancing) way to this. My scene consist of a 3 floor house I want to move around in, in a fps way.

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