 |
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 "./RayHitInfo.hpp"
14 Ray(const ::Ray& ray) {
20 direction = Direction;
24 set(::GetMouseRay(mousePosition, camera));
27 Ray& operator=(const ::Ray& ray) {
32 GETTERSETTER(::
Vector3, Position, position)
33 GETTERSETTER(::
Vector3, Direction, direction)
39 DrawRay(*
this, color);
47 return CheckCollisionRaySphere(*
this, center, radius);
54 ::
Vector3 *collisionPoint)
const {
55 return CheckCollisionRaySphereEx(*
this, center, radius, collisionPoint);
62 return CheckCollisionRayBox(*
this, box);
69 return GetCollisionRayModel(*
this, model);
76 return GetCollisionRayTriangle(*
this, p1, p2, p3);
83 return GetCollisionRayGround(*
this, groundHeight);
87 inline void set(const ::Ray& ray) {
88 position = ray.position;
89 direction = ray.direction;
94 #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.
RayHitInfo GetCollision(const ::Model &model) const
Get collision info between ray and model.
Ray type (useful for raycast)
bool CheckCollisionSphere(::Vector3 center, float radius) const
Detect collision between ray and sphere.
Camera type, defines a camera position/orientation in 3d space.
RayHitInfo GetCollisionTriangle(::Vector3 p1, ::Vector3 p2, ::Vector3 p3) const
Get collision info between ray and triangle.
bool CheckCollisionSphere(::Vector3 center, float radius, ::Vector3 *collisionPoint) const
Detect collision between ray and sphere, returns collision point.
RayHitInfo GetCollisionGround(float groundHeight) const
Get collision info between ray and ground plane (Y-normal plane)