createCollisionShapes

@MainThread
fun createCollisionShapes(recursive: Boolean = true): Int

Creates box CollisionComponents for mesh entities that do not already have one.

This method forwards recursive directly to the runtime's mesh-bound collision shape generator. Eligible entities must already contain mesh geometry and must not already contain a CollisionComponent.

The generated shapes approximate the corresponding mesh bounds with boxes.

Performance note: for very complex meshes and/or deep entity hierarchies (when recursive is true), shape generation may be expensive and can cause noticeable frame hitches if executed on the main thread.

Return

The number of collision shapes created by the runtime. Returns 0 if this entity is destroyed or no eligible mesh entity is found.

Parameters

recursive

Runtime option that controls whether descendant entities are included. The default value is true.