 |
raylib-cpp
C++ object-oriented wrapper library for raylib.
|
1 #ifndef RAYLIB_CPP_INCLUDE_RAY_HPP_
2 #define RAYLIB_CPP_INCLUDE_RAY_HPP_
4 #include "./raylib.hpp"
5 #include "./raylib-cpp-utils.hpp"
6 #include "./RayCollision.hpp"
14 Ray(const ::Ray& ray) {
21 set(::GetMouseRay(mousePosition, camera));
24 Ray& operator=(const ::Ray& ray) {
29 GETTERSETTER(::
Vector3, Position, position)
30 GETTERSETTER(::
Vector3, Direction, direction)
36 DrawRay(*
this, color);
44 return GetRayCollisionSphere(*
this, center, radius).hit;
51 return GetRayCollisionSphere(*
this, center, radius);
58 return GetRayCollisionBox(*
this, box).hit;
65 return GetRayCollisionBox(*
this, box);
72 return GetRayCollisionModel(*
this, model);
79 return GetRayCollisionTriangle(*
this, p1, p2, p3);
83 inline void set(const ::Ray& ray) {
84 position = ray.position;
85 direction = ray.direction;
90 #endif // RAYLIB_CPP_INCLUDE_RAY_HPP_
Ray & Draw(::Color color)
Draw a ray line.
All raylib-cpp classes and functions appear in the raylib namespace.
bool CheckCollision(const ::BoundingBox &box) const
Detect collision between ray and box.
RayCollision GetCollisionTriangle(::Vector3 p1, ::Vector3 p2, ::Vector3 p3) const
Get collision info between ray and triangle.
Ray type (useful for raycast)
RayCollision GetCollision(const ::BoundingBox &box) const
Get collision information between ray and box.
bool CheckCollisionSphere(::Vector3 center, float radius) const
Detect collision between ray and sphere.
RayCollision GetCollisionSphere(::Vector3 center, float radius) const
Get collision information between ray and sphere.
Camera type, defines a camera position/orientation in 3d space.
RayCollision GetCollision(const ::Model &model) const
Get collision info between ray and model.