8#include "core/reflect.h"
9#include "resource/asset/mesh_asset.h"
11namespace Vkm::Engine {
18enum class ColliderShape : uint8_t {
33 ColliderShape
shape = ColliderShape::Box;
34 glm::vec3
center = {0.0f, 0.0f, 0.0f};
49 glm::vec3 min = {0.0f, 0.0f, 0.0f};
50 glm::vec3 max = {0.0f, 0.0f, 0.0f};
63 glm::vec3
scale = {0.0f, 0.0f, 0.0f};
95VKM_ENUM_NAMES(::Vkm::Engine::ColliderShape,
"Box",
"Capsule",
"Mesh")
99VKM_REFLECT_BEGIN(::Vkm::Engine::ColliderPart)
109VKM_REFLECT_BEGIN(::Vkm::Engine::Collider)
One primitive of a collider, in the entity's local frame.
Definition collider.h:32
ColliderShape shape
Which fields below are live.
Definition collider.h:33
float halfHeight
Capsule: half the segment, caps excluded.
Definition collider.h:37
glm::vec3 halfExtents
Box: half-sizes.
Definition collider.h:35
float radius
Capsule: sweep radius.
Definition collider.h:36
MeshHandle mesh
Definition collider.h:38
glm::vec3 center
Local offset from the entity origin.
Definition collider.h:34
glm::vec3 meshScale
Mesh: applied to every vertex, as Transform scale is not.
Definition collider.h:40
Collision geometry attached to an entity, evaluated in its Transform frame.
Definition collider.h:72
std::vector< MeshNode > meshNodes
Bounding hierarchy over meshPoints, built with them.
Definition collider.h:85
std::vector< ColliderPart > parts
One or more parts; a single unit box by default.
Definition collider.h:74
MeshColliderSource meshBuiltFrom
What the two above were built from.
Definition collider.h:86
std::vector< glm::vec3 > meshPoints
The mesh part's triangle corners, three a triangle, in the part's frame, scaled by meshScale.
Definition collider.h:83
bool isTrigger
Definition collider.h:88
bool enabled
False: inert - no broadphase entry, no contacts, no debug draw.
Definition collider.h:90
What a Collider's triangles were built from, so a change to any of it rebuilds them.
Definition collider.h:60
uint64_t uid
The mesh asset, by Resource::uid; zero for none.
Definition collider.h:61
glm::vec3 scale
The part's meshScale when built.
Definition collider.h:63
uint64_t version
Its Resource::version when built.
Definition collider.h:62
One node of a triangle mesh's bounding hierarchy.
Definition collider.h:48
uint32_t firstTriangle
Leaf: first triangle; interior: unused.
Definition collider.h:52
uint32_t rightChild
Interior: the far child; left is this + 1.
Definition collider.h:54
uint32_t triangleCount
0 marks an interior node
Definition collider.h:53
Component representing a renderable mesh (geometry + material) in the world.
Definition mesh.h:13