Jump to content

scaling and renderOutline not working properly


Go to solution Solved by Temechon,

Recommended Posts

Hello everyone, 

 

i'm trying to use mesh.renderOutline = true to get an outline on an object which has been scaled in one direction. But instead i get a floating plane in this direction.

 

I guess the outline is made by inserting planes under the faces of the mesh and letting the edges "stick out" and there is some problem with scaling of the target mesh.

 

Here an example in pg:

http://www.babylonjs-playground.com/#1KJG6O#1

 

I hope someone can help me. A workaround would be to create every time i want to scale my box a new box with the right dimensions. But as the scaling may happen every frame i suppose this would not be good idea.

 

Thanks and Greetings,

moreAPI

Link to post
Share on other sites
  • Solution

Hello :) 

 

Welcome on this forum! 

The outline is done by retrieving the vertex positions of the mesh. Scaling a mesh does not update these positions.

 

However, you can do something like this: http://www.babylonjs-playground.com/#1KJG6O#3

 

Be careful, bakeCurrentTransformIntoVertices will *reset* your mesh scaling to 1 by updating its vertice positions. It also do the same for position and rotation, and may generated side-effects.

I think it's more of a workaround than a fix to your problem, but it's not that easy to fix directly in the engine. Hope that help though !

 

Cheers!

Link to post
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...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...