class PhysicsMesh

Inherits: Resource

Represents a physics mesh that can be used with a MeshCollider.

Physics mesh can be a generic triangle mesh or a convex mesh. Convex meshes are limited to 255 faces.

Public

Constructors

PhysicsMesh

PhysicsMesh(const SPtr<MeshData> &meshData, PhysicsMeshType type)

Methods

~PhysicsMesh

virtual ~PhysicsMesh() noexcept = default

GetType

PhysicsMeshType GetType() const

Returns the type of the physics mesh.

GetMeshData

SPtr<MeshData> GetMeshData() const

Returns the mesh's indices and vertices.

staticCreate

static HPhysicsMesh Create(const SPtr<MeshData> &meshData, PhysicsMeshType type = PhysicsMeshType::Convex)

Creates a new physics mesh.

meshData
Index and vertices of the mesh data.
type
Type of the mesh. If convex the provided mesh geometry will be converted into a convex mesh (that might not be the same as the provided mesh data).

staticGetRttiStatic

static RTTIType *GetRttiStatic()

GetRtti

RTTIType *GetRtti() const override

Returns an interface you can use to access class' Run Time Type Information.

Internal

Methods

GetImplementation

virtual IPhysicsMeshImplementation *GetImplementation()

Returns the internal implementation of the physics mesh.

staticCreateShared

static SPtr<PhysicsMesh> CreateShared(const SPtr<MeshData> &meshData, PhysicsMeshType type)

staticCreateEmpty

static SPtr<PhysicsMesh> CreateEmpty()

Creates an empty and uninitialized object instance.

To be used by serialization.

Protected

Methods

Initialize

void Initialize() override

Initializes all the internal data of this object.

Must be called right after construction for new objects, or after deserialization for deserialized objects. If requested, render proxy is created and queued for initialization on the render thread.

Destroy

void Destroy() override

Frees all the data held by this object.

If the object has a render proxy, the internal reference to the render proxy will be released, but the proxy will not be destroyed unless this was the last reference. If render proxy destruction does happen, it is not immediate, but rather queued for destruction on the render thread.

Fields

mImplementation

SPtr<IPhysicsMeshImplementation> mImplementation

mInitMeshData

SPtr<MeshData> mInitMeshData

mType