Dawn/archive/physics_components/2d/SolidController2D.hpp

42 lines
1.6 KiB
C++

// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "Collider2D.hpp"
#include "BoxCollider.hpp"
namespace Dawn {
class SolidController2D : public SceneItemComponent {
public:
std::shared_ptr<Collider2D> collider;
SolidController2D(std::weak_ptr<SceneItem> item);
std::vector<std::shared_ptr<SceneItemComponent>> getDependencies() override;
/**
* Gets the result of checking if two collider bodies are intersecting.
* This is performed WITH movement to return entry and exit times.
*
* @param result Where to store the results of the calculation.
* @param movement Movement operation that THIS object is performing.
* @param movingObject Moving Object Collider that is being compared.
* @param normal Output normal of the intersection.
* @param entryTime Output entry time when the two objects will intersect.
* @param exitTime Output exit time when the object will pass through.
* @param entryPoint Output point in 2D space where object will enter.
* @param exitPoint Output point where object will have passed through.
* @return True if the two objects will intersect at move otherwise false.
*/
bool_t getCollidingResult(
glm::vec2 movement,
std::shared_ptr<Collider2D> movingObject,
glm::vec2 &normal,
float_t &entryTime,
float_t &exitTime,
glm::vec2 &entryPoint,
glm::vec2 &exitPoint
);
};
}