Kemena3D
Loading...
Searching...
No Matches
kemena::kPhysicsShapeDesc Struct Reference

Parameters that fully describe a collision shape. More...

#include <kphysicsobject.h>

Public Attributes

kPhysicsShapeType type = kPhysicsShapeType::Box
kVec3 halfExtents = kVec3(0.5f, 0.5f, 0.5f)
 Box / Plane: per-axis half-extents (Plane uses x,z).
float radius = 0.5f
 Sphere / Capsule / Cylinder radius.
float height = 1.0f
 Capsule / Cylinder total height.
kVec3 customScale = kVec3(1.0f, 1.0f, 1.0f)
 ConvexHull / Mesh per-axis scale.
std::vector< kVec3meshVertices
 Mesh / ConvexHull source vertices.
std::vector< uint32_t > meshIndices
 Mesh source indices (triplets per triangle).

Detailed Description

Parameters that fully describe a collision shape.

Only the fields relevant to the chosen type need to be set.

type relevant fields
Sphere radius
Box halfExtents
Capsule radius, height (total, tip-to-tip)
Cylinder radius, height (total)
ConvexHull meshVertices + customScale (per-axis stretch)
Mesh meshVertices + meshIndices + customScale
Plane halfExtents.x / halfExtents.z (broadphase rect)

meshVertices / meshIndices are populated by the caller right before kPhysicsManager::createObject() (typically from the owning kMesh) — they aren't serialised because they're derived from the mesh asset.

customScale is applied to ConvexHull / Mesh shapes via Jolt's ScaledShape wrapper so the user can stretch a mesh-derived collider on each axis. Defaults to (1,1,1).

Member Data Documentation

◆ customScale

kVec3 kemena::kPhysicsShapeDesc::customScale = kVec3(1.0f, 1.0f, 1.0f)

ConvexHull / Mesh per-axis scale.

◆ halfExtents

kVec3 kemena::kPhysicsShapeDesc::halfExtents = kVec3(0.5f, 0.5f, 0.5f)

Box / Plane: per-axis half-extents (Plane uses x,z).

◆ height

float kemena::kPhysicsShapeDesc::height = 1.0f

Capsule / Cylinder total height.

◆ meshIndices

std::vector<uint32_t> kemena::kPhysicsShapeDesc::meshIndices

Mesh source indices (triplets per triangle).

◆ meshVertices

std::vector<kVec3> kemena::kPhysicsShapeDesc::meshVertices

Mesh / ConvexHull source vertices.

◆ radius

float kemena::kPhysicsShapeDesc::radius = 0.5f

Sphere / Capsule / Cylinder radius.

◆ type

kPhysicsShapeType kemena::kPhysicsShapeDesc::type = kPhysicsShapeType::Box

The documentation for this struct was generated from the following file: