Shape

interface Shape : RefCounted

A baked, physics-ready form of a Geometry. You can use this object as the shape of a Collider, however cannot get the original values of the Geometry back.

If you need to access the original geometry, consider storing that alongside your shape.

Rapier implementation

Internally, Rapier uses Rust Arc structures for atomic reference-counting of shapes. This Shape class is a wrapper around a single individual instance of Arc, not the data stored by the Arc. However, the equality and hash-code operations for the shape are based on the underlying data stored, rather than the individual reference-counting object. Therefore, it is safe to use a Shape as a key, and test for reference equality with them, only if the underlying shape is not freed (Destroyable.destroy'ed) yet (otherwise you would be accessing a freed Arc, with an undefined data pointer).

Properties

Link copied to clipboard
abstract val refCount: Long

Functions

Link copied to clipboard
abstract override fun acquire(): Shape

Adds one to the reference count of this object.

Link copied to clipboard
abstract override fun release(): Shape

Removes one from the reference count of this object. If the object's reference count drops to 0, it will be freed and be unusable.