raylib-cpp
C++ object-oriented wrapper library for raylib.
Public Member Functions | Protected Member Functions | List of all members
raylib::Ray Class Reference

Ray type (useful for raycast) More...

Public Member Functions

 Ray (::Vector2 mousePosition, ::Camera camera)
 
 Ray (::Vector3 Position, ::Vector3 Direction)
 
 Ray (const ::Ray &ray)
 
bool CheckCollision (const ::BoundingBox &box) const
 Detect collision between ray and box. More...
 
bool CheckCollisionSphere (::Vector3 center, float radius) const
 Detect collision between ray and sphere. More...
 
bool CheckCollisionSphere (::Vector3 center, float radius, ::Vector3 *collisionPoint) const
 Detect collision between ray and sphere, returns collision point. More...
 
Ray & Draw (::Color color)
 Draw a ray line. More...
 
RayHitInfo GetCollision (const ::Model &model)
 Get collision info between ray and model. More...
 
RayHitInfo GetCollisionGround (float groundHeight)
 Get collision info between ray and ground plane (Y-normal plane) More...
 
RayHitInfo GetCollisionTriangle (::Vector3 p1, ::Vector3 p2, ::Vector3 p3)
 Get collision info between ray and triangle. More...
 
inline ::Vector3 GetDirection () const
 
inline ::Vector3 GetPosition () const
 
Ray & operator= (const ::Ray &ray)
 
void SetDirection (::Vector3 value)
 
void SetPosition (::Vector3 value)
 

Protected Member Functions

void set (const ::Ray &ray)
 

Detailed Description

Ray type (useful for raycast)

Definition at line 38 of file Ray.hpp.

Constructor & Destructor Documentation

◆ Ray() [1/3]

raylib::Ray::Ray ( const ::Ray &  ray)
inline

Definition at line 40 of file Ray.hpp.

References set().

◆ Ray() [2/3]

raylib::Ray::Ray ( ::Vector3  Position,
::Vector3  Direction 
)
inline

Definition at line 44 of file Ray.hpp.

◆ Ray() [3/3]

raylib::Ray::Ray ( ::Vector2  mousePosition,
::Camera  camera 
)
inline

Definition at line 49 of file Ray.hpp.

References set().

Member Function Documentation

◆ CheckCollision()

bool raylib::Ray::CheckCollision ( const ::BoundingBox &  box) const
inline

Detect collision between ray and box.

Definition at line 87 of file Ray.hpp.

◆ CheckCollisionSphere() [1/2]

bool raylib::Ray::CheckCollisionSphere ( ::Vector3  center,
float  radius 
) const
inline

Detect collision between ray and sphere.

Definition at line 72 of file Ray.hpp.

◆ CheckCollisionSphere() [2/2]

bool raylib::Ray::CheckCollisionSphere ( ::Vector3  center,
float  radius,
::Vector3 *  collisionPoint 
) const
inline

Detect collision between ray and sphere, returns collision point.

Definition at line 79 of file Ray.hpp.

◆ Draw()

Ray& raylib::Ray::Draw ( ::Color  color)
inline

Draw a ray line.

Definition at line 64 of file Ray.hpp.

◆ GetCollision()

RayHitInfo raylib::Ray::GetCollision ( const ::Model &  model)
inline

Get collision info between ray and model.

Definition at line 94 of file Ray.hpp.

◆ GetCollisionGround()

RayHitInfo raylib::Ray::GetCollisionGround ( float  groundHeight)
inline

Get collision info between ray and ground plane (Y-normal plane)

Definition at line 108 of file Ray.hpp.

◆ GetCollisionTriangle()

RayHitInfo raylib::Ray::GetCollisionTriangle ( ::Vector3  p1,
::Vector3  p2,
::Vector3  p3 
)
inline

Get collision info between ray and triangle.

Definition at line 101 of file Ray.hpp.

◆ GetDirection()

inline ::Vector3 raylib::Ray::GetDirection ( ) const
inline

Definition at line 59 of file Ray.hpp.

◆ GetPosition()

inline ::Vector3 raylib::Ray::GetPosition ( ) const
inline

Definition at line 58 of file Ray.hpp.

◆ operator=()

Ray& raylib::Ray::operator= ( const ::Ray &  ray)
inline

Definition at line 53 of file Ray.hpp.

References set().

◆ set()

void raylib::Ray::set ( const ::Ray &  ray)
inlineprotected

Definition at line 113 of file Ray.hpp.

Referenced by operator=(), and Ray().

◆ SetDirection()

void raylib::Ray::SetDirection ( ::Vector3  value)
inline

Definition at line 59 of file Ray.hpp.

◆ SetPosition()

void raylib::Ray::SetPosition ( ::Vector3  value)
inline

Definition at line 58 of file Ray.hpp.