more cleanup

This commit is contained in:
Clément Le Bihan
2021-06-08 00:55:32 +02:00
parent 3649c8247c
commit ca930db44d
2 changed files with 2 additions and 9 deletions
@@ -15,6 +15,7 @@ namespace BBM
{
public:
//! @brief Used to tell the collided axis
//! @note Usage: (collidedAxis (int given by callback)) & CollidedAxis::X
enum CollidedAxis {
X = 1,
Y = 2,
@@ -53,7 +54,7 @@ namespace BBM
//! @brief Constructor of collider with no callback
CollisionComponent(WAL::Entity &entity, Vector3f positionOffset, Vector3f bound);
//! @brief Constructor no callback, same boundSize for all axis
//! @brief Constructor no callback, same boundSize & positionOffset for all axis
CollisionComponent(WAL::Entity &entity, float positionOffset, float boundSize);
//! @brief Default copy constructor
-8
View File
@@ -15,17 +15,9 @@ namespace BBM
void MapGenerator::wallCollide(WAL::Entity &entity, const WAL::Entity &wall, int collidedAxis)
{
auto *mov = entity.tryGetComponent<MovableComponent>();
auto posspec = entity.getComponent<PositionComponent>();
auto posspecwall = wall.getComponent<PositionComponent>();
if (!mov)
return;
auto &pos = entity.getComponent<PositionComponent>();
const auto &wallPos = wall.getComponent<PositionComponent>();
auto diff = pos.position + mov->getVelocity() - wallPos.position;
//mov->_velocity = Vector3f();
//return;
if (collidedAxis & CollisionComponent::CollidedAxis::X)
mov->_velocity.x = 0;
if (collidedAxis & CollisionComponent::CollidedAxis::Y)