Jump to content

ImportMesh with renderOutline


peraxel7
 Share

Recommended Posts

Hi, new to Babylon.js and the forum. I want to use the renderOutline property on the rabbit.babylon model from BONES demo.

BABYLON.SceneLoader.ImportMesh("", "models/", "rabbit.babylon", scene, function (newMeshes, particleSystems, skeletons) {
  var mdl_Rabbit = newMeshes[0];
  mdl_Rabbit.position = new BABYLON.Vector3(0, 0, 40);
  mdl_Rabbit.renderOutline = true;
});

It changes the position of the rabbit but it does not render outline. Also for some reason, I could use newMeshes[12] and the rabbit would still display correctly. mdl_Rabbit.showBoundingBox doesn't work either.

Overall it's obvious I don't understand how the ImportMesh works. So, what am I missing and how do I get renderOutline to work?

Link to comment
Share on other sites

Hi @peraxel7 

it might already be working, but very hard to see.

try adding outlineWidth and outlineColor to make it more visible, see example below of skull PG demo.

http://www.babylonjs-playground.com/#18ZFZ9

Update;

I just tried doing it on the rabbit, and it doesn't work out of the box because the rabbit is made out of several meshes, in which case you need to "apply" the outline on each mesh.

see; http://www.babylonjs-playground.com/#18ZFZ9#2

Link to comment
Share on other sites

Ok, got it working now. I was actually surprised that debugLayer could show the bounding box whereas I had failed. Thanks for the comments. Iterating all the meshes to outline all of them will probably come into use one of these days at well.

Turns out I needed to set newMeshes[0] to newMeshes[1].

At least I got to spend a few hours reading the documentation :) Onwards to the next user error!
 

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