|
SleakEngine 1.0.0
C++23 multi-backend game engine
|
#include <ColliderComponent.hpp>
Public Member Functions | |
| ColliderComponent (GameObject *owner, const MeshData &meshData, bool asMesh) | |
| ColliderComponent (GameObject *owner, const MeshData &meshData, Physics::ColliderType preferred) | |
| Derives a bounding shape of the given type from the mesh's vertex positions. | |
| ColliderComponent (GameObject *owner, const Physics::AABB &aabb) | |
| Wraps a pre-built axis-aligned box shape. | |
| ColliderComponent (GameObject *owner, const Physics::BoundingCapsule &capsule) | |
| Wraps a pre-built capsule shape. | |
| ColliderComponent (GameObject *owner, const Physics::BoundingSphere &sphere) | |
| Wraps a pre-built sphere shape. | |
| ~ColliderComponent () override=default | |
| uint32_t | GetLayer () const |
| uint32_t | GetMask () const |
| Math::Vector3D | GetOffset () const |
| int | GetProxyId () const |
| const Physics::ColliderShape & | GetShape () const |
| Physics::ColliderType | GetType () const |
| Physics::AABB | GetWorldAABB () const |
| Local shape transformed into world space by the owner's current transform. | |
| bool | Initialize () override |
| One-time setup, called after the component is attached and the owner is initialized. | |
| bool | IsTrigger () const |
| void | SetLayer (uint32_t layer) |
| void | SetMask (uint32_t mask) |
| void | SetOffset (const Math::Vector3D &offset) |
| void | SetProxyId (int id) |
| void | SetTrigger (bool trigger) |
| void | Update (float deltaTime) override |
| Public Member Functions inherited from Sleak::Component | |
| Component (GameObject *object) | |
| virtual | ~Component ()=default |
| virtual void | FixedUpdate (float fixedDeltaTime) |
| GameObject * | GetOwner () |
| virtual void | LateUpdate (float deltaTime) |
| virtual void | OnDestroy () |
| Called when the component is detached or the owner is destroyed. | |
| virtual void | OnDisable () |
| virtual void | OnEnable () |
| Public Member Functions inherited from Sleak::Object | |
| Object (const std::string &name="Object") | |
| virtual | ~Object ()=default |
| const std::string & | GetName () const |
| uint64_t | GetUniqueID () const |
| void | SetName (const std::string &value) |
Additional Inherited Members | |
| Protected Attributes inherited from Sleak::Component | |
| bool | bIsInitialized |
| GameObject * | owner |
Attaches a collision shape to a GameObject and registers it with PhysicsWorld's broadphase.
Attach the shape that matches the object: Physics::AABB for boxes and level geometry, Physics::BoundingSphere for projectiles and simple characters, Physics::BoundingCapsule for upright figures. Two more constructors derive a shape from MeshData, either a bounding volume of a type you pick or an exact triangle mesh.
Registration is automatic. Adding the owning GameObject to a scene registers the collider (and any on child objects) with that scene's Physics::PhysicsWorld, and removing the object unregisters it. The shape you supply is in local space; GetWorldAABB() applies the owner's current transform.
Layer and mask filter both collision response and the world query API, so put triggers, terrain, and characters on distinct layers and a raycast can ignore the ones it does not care about. Marking a collider as a trigger keeps it in the broadphase while skipping physical response.
Definition at line 57 of file ColliderComponent.hpp.
| Sleak::ColliderComponent::ColliderComponent | ( | GameObject * | owner, |
| const Physics::AABB & | aabb ) |
Wraps a pre-built axis-aligned box shape.
Definition at line 9 of file ColliderComponent.cpp.
| Sleak::ColliderComponent::ColliderComponent | ( | GameObject * | owner, |
| const Physics::BoundingSphere & | sphere ) |
Wraps a pre-built sphere shape.
Definition at line 12 of file ColliderComponent.cpp.
| Sleak::ColliderComponent::ColliderComponent | ( | GameObject * | owner, |
| const Physics::BoundingCapsule & | capsule ) |
Wraps a pre-built capsule shape.
Definition at line 15 of file ColliderComponent.cpp.
| Sleak::ColliderComponent::ColliderComponent | ( | GameObject * | owner, |
| const MeshData & | meshData, | ||
| Physics::ColliderType | preferred ) |
Derives a bounding shape of the given type from the mesh's vertex positions.
Definition at line 18 of file ColliderComponent.cpp.
| Sleak::ColliderComponent::ColliderComponent | ( | GameObject * | owner, |
| const MeshData & | meshData, | ||
| bool | asMesh ) |
Builds an exact triangle-mesh collider when asMesh is true; otherwise falls back to an AABB computed from the mesh's vertices.
Definition at line 57 of file ColliderComponent.cpp.
|
overridedefault |
|
inline |
Definition at line 90 of file ColliderComponent.hpp.
|
inline |
Definition at line 92 of file ColliderComponent.hpp.
|
inline |
Definition at line 86 of file ColliderComponent.hpp.
|
inline |
Definition at line 100 of file ColliderComponent.hpp.
|
inline |
Definition at line 78 of file ColliderComponent.hpp.
|
inline |
Definition at line 79 of file ColliderComponent.hpp.
| Physics::AABB Sleak::ColliderComponent::GetWorldAABB | ( | ) | const |
Local shape transformed into world space by the owner's current transform.
Definition at line 87 of file ColliderComponent.cpp.
|
overridevirtual |
One-time setup, called after the component is attached and the owner is initialized.
Implements Sleak::Component.
Definition at line 78 of file ColliderComponent.cpp.
|
inline |
Definition at line 96 of file ColliderComponent.hpp.
|
inline |
Definition at line 89 of file ColliderComponent.hpp.
|
inline |
Definition at line 91 of file ColliderComponent.hpp.
|
inline |
Definition at line 85 of file ColliderComponent.hpp.
|
inline |
Definition at line 99 of file ColliderComponent.hpp.
|
inline |
Definition at line 95 of file ColliderComponent.hpp.
|
overridevirtual |
Implements Sleak::Component.
Definition at line 83 of file ColliderComponent.cpp.