1#ifndef RAYLIB_CPP_INCLUDE_RAY_HPP_
2#define RAYLIB_CPP_INCLUDE_RAY_HPP_
5#include "./raylib-cpp-utils.hpp"
6#include "./RayCollision.hpp"
12class Ray :
public ::Ray {
14 Ray(const ::Ray& ray) {
18 Ray(::Vector3 position, ::Vector3 direction = {0.0f, 0.0f, 0.0f}) :
::Ray{position, direction} {
23 set(::GetMouseRay(mousePosition, camera));
31 GETTERSETTER(::Vector3, Position, position)
32 GETTERSETTER(::
Vector3, Direction, direction)
38 DrawRay(*
this, color);
46 return GetRayCollisionSphere(*
this, center, radius).hit;
53 return GetRayCollisionSphere(*
this, center, radius);
60 return GetRayCollisionBox(*
this, box).hit;
67 return GetRayCollisionModel(*
this, model);
74 return GetRayCollisionMesh(*
this, mesh, transform);
81 return GetRayCollisionTriangle(*
this, p1, p2, p3);
88 return GetRayCollisionQuad(*
this, p1, p2, p3, p4);
92 inline void set(const ::Ray& ray) {
93 position = ray.position;
94 direction = ray.direction;
Ray type (useful for raycast)
RayCollision GetCollision(const ::Model &model) const
Get collision info between ray and model.
bool CheckCollisionSphere(::Vector3 center, float radius) const
Detect collision between ray and sphere.
Ray & Draw(::Color color)
Draw a ray line.
RayCollision GetCollision(::Vector3 center, float radius) const
Get collision information between ray and sphere.
RayCollision GetCollision(::Vector3 p1, ::Vector3 p2, ::Vector3 p3) const
Get collision info between ray and triangle.
Ray(::Vector3 position, ::Vector3 direction={0.0f, 0.0f, 0.0f})
RayCollision GetCollision(const ::Mesh &mesh, const ::Matrix &transform) const
Get collision information between ray and mesh.
Ray & operator=(const ::Ray &ray)
Ray(::Vector2 mousePosition, ::Camera camera)
bool CheckCollision(const ::BoundingBox &box) const
Detect collision between ray and box.
RayCollision GetCollision(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4) const
Get collision info between ray and quad.
All raylib-cpp classes and functions appear in the raylib namespace.