Skip to main content

<pc-collision>

The <pc-collision> tag is used to define a collision component.

note

Attributes

AttributeDescription
axisThe axis of the collision component. If not specified, 1 is used (Y-axis).
convex-hullValueless attribute. If present, the collision component uses a convex hull.
enabledEnabled state of the collision component. If not specified, true is used.
half-extentsThe half-extents of the collision component. Specified as a space-separated list of X, Y, and Z values. If not specified, 0.5 0.5 0.5 is used.
heightThe height of the collision component. If not specified, 2 is used.
radiusThe radius of the collision component. If not specified, 0.5 is used.
typeThe type of collision component. Can be box, capsule, cone, cylinder or sphere. If not specified, box is used.

Example

<!-- static 1x1x1 box -->
<pc-entity>
<pc-render type="box"></pc-render>
<pc-collision></pc-collision>
<pc-rigidbody></pc-rigidbody>
</pc-entity>

<!-- dynamic sphere with radius 0.5 -->
<pc-entity>
<pc-render type="sphere"></pc-render>
<pc-collision type="sphere"></pc-collision>
<pc-rigidbody type="dynamic"></pc-rigidbody>
</pc-entity>

JavaScript Interface

You can programmatically create and manipulate <pc-collision> elements using the CollisionComponentElement API.