 |
raylib-cpp
C++ object-oriented wrapper library for raylib.
|
25 #ifndef RAYLIB_CPP_INCLUDE_RAY_HPP_
26 #define RAYLIB_CPP_INCLUDE_RAY_HPP_
28 #include "./raylib.hpp"
30 #include "./raylib-cpp-utils.hpp"
32 #include "./RayHitInfo.hpp"
40 Ray(const ::Ray& ray) {
46 direction = Direction;
50 set(GetMouseRay(mousePosition, camera));
58 GETTERSETTER(::
Vector3, Position, position)
59 GETTERSETTER(::
Vector3, Direction, direction)
65 DrawRay(*
this, color);
73 return CheckCollisionRaySphere(*
this, center, radius);
80 ::
Vector3 *collisionPoint)
const {
81 return CheckCollisionRaySphereEx(*
this, center, radius, collisionPoint);
88 return CheckCollisionRayBox(*
this, box);
95 return GetCollisionRayModel(*
this, model);
102 return GetCollisionRayTriangle(*
this, p1, p2, p3);
109 return GetCollisionRayGround(*
this, groundHeight);
113 inline void set(const ::Ray& ray) {
114 position = ray.position;
115 direction = ray.direction;
120 #endif // RAYLIB_CPP_INCLUDE_RAY_HPP_
Ray & Draw(::Color color)
Draw a ray line.
Provides all the classes associated with raylib-cpp.
bool CheckCollision(const ::BoundingBox &box) const
Detect collision between ray and box.
Ray type (useful for raycast)
bool CheckCollisionSphere(::Vector3 center, float radius) const
Detect collision between ray and sphere.
Ray(::Vector3 Position, ::Vector3 Direction)
Ray(::Vector2 mousePosition, ::Camera camera)
RayHitInfo GetCollisionTriangle(::Vector3 p1, ::Vector3 p2, ::Vector3 p3)
Get collision info between ray and triangle.
RayHitInfo GetCollision(const ::Model &model)
Get collision info between ray and model.
bool CheckCollisionSphere(::Vector3 center, float radius, ::Vector3 *collisionPoint) const
Detect collision between ray and sphere, returns collision point.
RayHitInfo GetCollisionGround(float groundHeight)
Get collision info between ray and ground plane (Y-normal plane)
Ray & operator=(const ::Ray &ray)
void set(const ::Ray &ray)