Can I create Custom shapes by scripting in PlayCanvas?

Hi,
I wonder if I can create parameteric shapes such as Arc, Curve, Box by using script. Each shape will have customized size, rotation and position.
I can’t find any suitable answer anywhere.

Hi @Usman_Hameed and welcome,

Yes, you can use the Mesh API to create custom shapes by providing vertex positions and indices. Here is the full API:

https://developer.playcanvas.com/api/pc.Mesh.html

Here is an example using it:
https://playcanvas.github.io/#/graphics/mesh-generation

And here is how the engine produces the internal primitives like box and sphere:

1 Like