How to add contours to a model

How to add contours to a model

In the example, how to add it to the square of the rule and how to add it to the self-made model

Hi @yang1117,

By contours you mean an outline like in the engine example you reference?

Then you need to look at line 128 of that example, the outline renders on any render component that has the outline layer in its layers list. So just add that layer in any model of yours similarly:


In the example, the type is a box or ball. If it is an irregular car, how to write the type

Ah in that case you don’t write the type, those methods are used to add primitives.

For custom models you need to load the model file, check this example:

You can then add the outline layer like this:

clone.render.layers = [,];
1 Like

When the type is not written here, the outline will not appear in the screen

No, you don’t use type, you need to add the outline layers to the list of layers as state above. You are trying to add a plane entity in addition to your model entity, no need for that.

Try this:

entity.render.layers = [,];

Or if your model has a more complex hierarchy with multiple render components:

entity.findComponents('render').forEach(render => {
   render.layers = [,];
1 Like

If not set, then this render is empty

Setting directly as mentioned above will result in an error

use model instead of render as you seem to use model components.

1 Like
Based on this case, how can I modify it.
To meet the above needs

Just replace render with model:

entity.model.layers = [,];

Thank you

1 Like