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¶
- int queryTriangles(
- const AABB &localBounds,
- uint16_t *outCandidates,
- int maxCandidates
Query the static local-space BVH, returning triangle indices directly.
-
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.
-
inline bool hasTransform() const¶
Returns true if the mesh has a non-identity transform.
-
inline bool hasRotation() const¶
Returns true if the mesh has a non-identity rotation.
-
inline bool hasPosition() const¶
Returns true if the mesh has a non-zero position.
-
inline bool hasScale() const¶
Returns true if the mesh has a non-uniform (1,1,1) scale.
-
bool readsMeshCollider(const MeshCollider *other) const¶
-
void destroyData()¶
Free owned geometry and BVH for manually defined geometry; detach borrowed asset data.
Public Static Functions
-
static MeshCollider *createFromRawData(const void *rawData, Object *obj)¶
Create a MeshCollider directly from collision asset raw data, binding to the given Object’s transform.
Borrows immutable vertices, triangles, float normals and BVH from the asset. rawData must outlive the collider (as scene assets do).
- 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). Builds the immutable triangle BVH once; geometry must not change afterwards. 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)¶