Just roughing physics
This commit is contained in:
31
src/dawn/scene/components/physics/2d/Ray2D.hpp
Normal file
31
src/dawn/scene/components/physics/2d/Ray2D.hpp
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "dawnlibs.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
struct Ray2D {
|
||||
const glm::vec2 position;
|
||||
const glm::vec2 direction;
|
||||
|
||||
/**
|
||||
* Constructs a new Ray 2D.
|
||||
*
|
||||
* @param position Position of this ray in 2D space.
|
||||
* @param direction Direction from the origin in 2D space of this ray.
|
||||
*/
|
||||
Ray2D(glm::vec2 position, glm::vec2 direction);
|
||||
|
||||
/**
|
||||
* Checks whether one ray is intersecting with another ray.
|
||||
*
|
||||
* @param ray The ray to check if this ray is intersecting.
|
||||
* @param out The point in space where the two rays intersect.
|
||||
* @return True if they intersect, otherwise false.
|
||||
*/
|
||||
bool_t intersects(struct Ray2D ray, glm::vec2 *out);
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user