-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: separate collider from shapes
- Loading branch information
1 parent
9f1b37d
commit c5a680c
Showing
10 changed files
with
128 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/// @file | ||
/// @brief Component @ref cubos::engine::Collider. | ||
/// @ingroup collisions-plugin | ||
|
||
#pragma once | ||
|
||
#include <glm/mat4x4.hpp> | ||
|
||
#include <cubos/engine/collisions/aabb.hpp> | ||
|
||
namespace cubos::engine | ||
{ | ||
/// @brief Component which adds a collider to an entity. | ||
/// @ingroup collisions-plugin | ||
struct [[cubos::component("cubos/collider", VecStorage)]] Collider | ||
{ | ||
glm::mat4 transform{1.0F}; ///< Transform of the collider. | ||
|
||
bool fresh = true; ///< Whether the collider is fresh. This is an hack and should be done in ECS. | ||
ColliderAABB localAABB; ///< Local space AABB of the collider. | ||
ColliderAABB worldAABB; ///< World space AABB of the collider. | ||
}; | ||
} // namespace cubos::engine |
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
engine/include/cubos/engine/collisions/colliders/capsule.hpp
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/// @file | ||
/// @brief Component @ref cubos::engine::BoxCollisionShape. | ||
/// @ingroup collisions-plugin | ||
|
||
#pragma once | ||
|
||
#include <cubos/core/geom/box.hpp> | ||
|
||
namespace cubos::engine | ||
{ | ||
/// @brief Component which adds a box collision shape to an entity, used with a collider component. | ||
/// @ingroup collisions-plugin | ||
struct [[cubos::component("cubos/box_collision_shape", VecStorage)]] BoxCollisionShape | ||
{ | ||
cubos::core::geom::Box shape; ///< Box shape. | ||
|
||
/// @brief Margin of the collider. Needed for collision stability. | ||
/// | ||
/// The collider margin avoids collision errors by rounding off sharp corners. It is | ||
/// absolute so the collider's transform won't affect it. Shouldn't be changed without good | ||
/// reason, as it's preferable to scale down the collider shape to account for it. | ||
float margin = 0.04F; | ||
}; | ||
} // namespace cubos::engine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/// @file | ||
/// @brief Component @ref cubos::engine::CapsuleCollisionShape. | ||
/// @ingroup collisions-plugin | ||
|
||
#pragma once | ||
|
||
#include <cubos/core/geom/capsule.hpp> | ||
|
||
namespace cubos::engine | ||
{ | ||
/// @brief Component which adds a capsule collision shape to an entity, used with a collider component. | ||
/// @ingroup collisions-plugin | ||
struct [[cubos::component("cubos/capsule_collision_shape", VecStorage)]] CapsuleCollisionShape | ||
{ | ||
cubos::core::geom::Capsule shape; ///< Capsule shape. | ||
}; | ||
} // namespace cubos::engine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.