6#ifndef KPHYSICSOBJECT_H
7#define KPHYSICSOBJECT_H
kPhysicsShapeType getShapeType() const
Returns the underlying collision shape type.
void setMass(float mass)
Changes the body mass (kg). No-op for Static bodies.
void setPosition(const kVec3 &position)
Teleports the body to a new world-space position.
void uninit()
Removes the body from the simulation and releases its resources.
uint32_t getBodyId() const
Returns the internal Jolt body ID (cast from JPH::BodyID).
kQuat getRotation() const
Returns the body's current world-space orientation.
void setLinearVelocity(const kVec3 &velocity)
Directly sets the linear velocity (m/s).
void setAngularDamping(float damping)
Sets the angular velocity drag coefficient (per second).
kVec3 getPosition() const
Returns the body's current world-space position.
void setLinearDamping(float damping)
Sets the linear velocity drag coefficient (per second).
kVec3 getAngularVelocity() const
Returns the current angular velocity (rad/s).
void applyTorque(const kVec3 &torque)
Applies a torque (N·m) for the current simulation step.
void setAngularVelocity(const kVec3 &velocity)
Directly sets the angular velocity (rad/s).
bool isActive() const
Returns true if the body is currently awake and being simulated.
kPhysicsObjectType getObjectType() const
Returns the motion type (Dynamic / Static / Kinematic / Trigger).
void setFriction(float friction)
Sets the coefficient of friction (0–1).
void setRestitution(float restitution)
Sets the coefficient of restitution / bounciness (0–1).
void applyForce(const kVec3 &force)
Applies a continuous force (N) at the centre of mass this step.
kVec3 getLinearVelocity() const
Returns the current linear velocity (m/s).
bool init(void *physicsSystem, const kPhysicsObjectDesc &desc)
Initialises the body inside an existing Jolt PhysicsSystem.
void setGravityFactor(float factor)
Scales the world gravity applied to this body.
void applyImpulse(const kVec3 &impulse)
Applies an instantaneous impulse (kg·m/s) at the centre of mass.
void setRotation(const kQuat &rotation)
Sets the body's world-space orientation.
Core type aliases, enumerations, structs, and utility functions used throughout the engine.
Symbol visibility / linkage macro for the Kemena3D library.
#define KEMENA3D_API
Definition kexport.h:35
Top-level Kemena3D engine namespace.
Definition kanimation.h:23
kPhysicsShapeType
Collision shape type.
Definition kphysicsobject.h:23
@ Plane
Infinite plane (object's local +Y); static-only (Jolt restriction).
Definition kphysicsobject.h:30
@ Cylinder
Cylinder defined by radius + total height.
Definition kphysicsobject.h:27
@ Box
Axis-aligned box defined by half-extents.
Definition kphysicsobject.h:25
@ ConvexHull
Convex hull of the object's mesh vertices; any motion type.
Definition kphysicsobject.h:28
@ Capsule
Capsule (cylinder + hemispherical end-caps) defined by radius + total height.
Definition kphysicsobject.h:26
@ Mesh
Triangle mesh from the object's mesh; static-only (Jolt restriction).
Definition kphysicsobject.h:29
@ Sphere
Uniform sphere defined by radius.
Definition kphysicsobject.h:24
glm::quat kQuat
Unit quaternion.
Definition kdatatype.h:40
glm::vec3 kVec3
3-component float vector.
Definition kdatatype.h:33
kPhysicsObjectType
Determines how the physics engine moves (or does not move) a body.
Definition kphysicsobject.h:75
@ Kinematic
Moved via setPosition / setVelocity; not affected by forces.
Definition kphysicsobject.h:78
@ Static
Immovable; used for world geometry and terrain.
Definition kphysicsobject.h:77
@ Dynamic
Full rigid-body simulation (affected by forces and gravity).
Definition kphysicsobject.h:76
@ Trigger
Detects overlaps but exerts no physical response.
Definition kphysicsobject.h:79
All parameters needed to create a kPhysicsObject.
Definition kphysicsobject.h:92
float angularDamping
Angular velocity drag per second.
Definition kphysicsobject.h:101
float linearDamping
Linear velocity drag per second.
Definition kphysicsobject.h:100
kVec3 position
Definition kphysicsobject.h:95
kPhysicsObjectType type
Definition kphysicsobject.h:94
kPhysicsShapeDesc shape
Definition kphysicsobject.h:93
float mass
kg; ignored for Static / Kinematic.
Definition kphysicsobject.h:97
float gravityFactor
Multiplier on world gravity (0 = gravity-free).
Definition kphysicsobject.h:102
float friction
0 = frictionless, 1 = high friction.
Definition kphysicsobject.h:98
float restitution
0 = inelastic, 1 = perfectly elastic.
Definition kphysicsobject.h:99
kQuat rotation
Identity quaternion.
Definition kphysicsobject.h:96
Parameters that fully describe a collision shape.
Definition kphysicsobject.h:57
std::vector< kVec3 > meshVertices
Mesh / ConvexHull source vertices.
Definition kphysicsobject.h:63
std::vector< uint32_t > meshIndices
Mesh source indices (triplets per triangle).
Definition kphysicsobject.h:64
kVec3 halfExtents
Box / Plane: per-axis half-extents (Plane uses x,z).
Definition kphysicsobject.h:59
kVec3 customScale
ConvexHull / Mesh per-axis scale.
Definition kphysicsobject.h:62
float height
Capsule / Cylinder total height.
Definition kphysicsobject.h:61
kPhysicsShapeType type
Definition kphysicsobject.h:58
float radius
Sphere / Capsule / Cylinder radius.
Definition kphysicsobject.h:60