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
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:
[worldLayer.id, outlineLayer.id]
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:
https://playcanvas.github.io/#/graphics/model-asset
You can then add the outline layer like this:
clone.render.layers = [worldLayer.id, outlineLayer.id];
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 = [worldLayer.id, outlineLayer.id];
Or if your model has a more complex hierarchy with multiple render components:
entity.findComponents('render').forEach(render => {
render.layers = [worldLayer.id, outlineLayer.id];
});
use model
instead of render
as you seem to use model components.
https://playcanvas.github.io/#/graphics/model-asset
Based on this case, how can I modify it.
To meet the above needs
Just replace render with model:
entity.model.layers = [worldLayer.id, outlineLayer.id];
Thank you