Struct MeshCollider¶
-
struct MeshCollider¶
Public Functions
-
inline void setCollisionMask(uint8_t newReadMask, uint8_t newWriteMask)¶
-
inline uint8_t readMask() const¶
-
inline uint8_t writeMask() const¶
-
inline void setFriction(float newFriction)¶
-
inline float friction() const¶
-
inline void setBounce(float newBounce)¶
-
inline float bounce() const¶
-
inline uint16_t triangleCount() const¶
-
inline uint16_t vertexCount() const¶
-
inline const fm_vec3_t &vertex(uint16_t index) const¶
-
inline const MeshTriangleIndices &triangleIndices(uint16_t index) const¶
-
inline const fm_vec3_t &triangleNormal(uint16_t index) const¶
- inline int queryTriangleNodes( ) const¶
- inline int queryTriangleNodes( ) const¶
-
inline uint32_t worldTransformVersion() const¶
-
inline bool hasCachedOwnerTransform() const¶
-
inline bool transformChanged() const¶
-
fm_vec3_t toWorldSpace(const fm_vec3_t &localPoint) const¶
Transform a local-space point to world space.
-
fm_vec3_t toLocalSpace(const fm_vec3_t &worldPoint) const¶
Transform a world-space point to local space.
-
fm_vec3_t rotateToWorld(const fm_vec3_t &localDir) const¶
Rotate a local-space direction/normal to world space (no translation)
-
fm_vec3_t rotateToLocal(const fm_vec3_t &worldDir) const¶
Rotate a world-space direction/normal to local space (no translation)
-
fm_vec3_t localNormalToWorld(const fm_vec3_t &localNormal) const¶
-
void recalculateWorldAabb()¶
Recompute worldAabb from localRootAabb + current transform.
-
bool hasOwnerTransformChanged() const¶
Returns true if the owner’s transform differs from the cached transform snapshot.
-
void syncOwnerTransform()¶
Updates the cached owner transform snapshot to the current owner transform.
-
AABB worldAabbToLocal(const AABB &worldAabb) const¶
Transform a world-space AABB into a conservative local-space AABB for tree queries.
-
bool hasTransform() const¶
Returns true if the mesh has a non-identity transform.
-
bool hasRotation() const¶
Returns true if the mesh has a non-identity rotation.
-
bool hasPosition() const¶
Returns true if the mesh has a non-zero position.
-
bool hasScale() const¶
Returns true if the mesh has a non-uniform (1,1,1) scale.
-
bool readsMeshCollider(const MeshCollider *other) const¶
Public Static Functions
-
static MeshCollider *createFromRawData(void *rawData, Object *obj)¶
Create a MeshCollider directly from collision asset raw data, binding to the given Object’s transform.
The returned collider owns newly allocated arrays (vertices, triangles, normals). Call destroyData() to free them.
- static MeshCollider *create(
- fm_vec3_t *vertices,
- uint16_t vertexCount,
- MeshTriangleIndices *triangleIndices,
- uint16_t triangleCount,
- Object *owner = nullptr
Create a MeshCollider from manually defined geometry.
If a non-null owner Object is given, the MeshCollider’s transform will be synced to that of the owner. Coordinates must use internal physics scale (i.e. 1 unit = 1 meter). Ownership of the given arrays (vertices, triangleIndices) is transferred to the returned MeshCollider object; call destroyData() to free them.
- static inline fm_vec3_t triangleNormalFromVertices(
- const fm_vec3_t &v0,
- const fm_vec3_t &v1,
- const fm_vec3_t &v2
-
inline void setCollisionMask(uint8_t newReadMask, uint8_t newWriteMask)¶