diff options
| author | Ray <[email protected]> | 2017-01-05 17:33:23 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-01-05 17:33:23 +0100 |
| commit | 0369bb4c8cfe8988634a09d56c307b73be281452 (patch) | |
| tree | 0861780ddb9b024fff87bdd22e7be37d60d7facb /src/raylib.h | |
| parent | 81388363fa844956d0e1d023693f803c5ec21c7a (diff) | |
| parent | d5d391faaf69027b8fecb26f30754c3bff83c311 (diff) | |
| download | raylib-0369bb4c8cfe8988634a09d56c307b73be281452.tar.gz raylib-0369bb4c8cfe8988634a09d56c307b73be281452.zip | |
Merge pull request #212 from joeld42/jbd_picking
Raycast Picking Utilities
Diffstat (limited to 'src/raylib.h')
| -rw-r--r-- | src/raylib.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/raylib.h b/src/raylib.h index e2e4ee13..7252ba4e 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -97,6 +97,9 @@ #define DEG2RAD (PI/180.0f) #define RAD2DEG (180.0f/PI) +// A small number +#define EPSILON 0.000001 + // raylib Config Flags #define FLAG_FULLSCREEN_MODE 1 #define FLAG_RESIZABLE_WINDOW 2 @@ -491,6 +494,14 @@ typedef struct Ray { Vector3 direction; // Ray direction } Ray; +// Information returned from a raycast +typedef struct RayHitInfo { + bool hit; // Did the ray hit something? + float distance; // Distance to nearest hit + Vector3 hitPosition; // Position of nearest hit + Vector3 hitNormal; // Surface normal of hit +} RayHitInfo; + // Wave type, defines audio wave data typedef struct Wave { unsigned int sampleCount; // Number of samples @@ -911,6 +922,13 @@ RLAPI bool CheckCollisionRaySphereEx(Ray ray, Vector3 spherePosition, float sphe RLAPI bool CheckCollisionRayBox(Ray ray, BoundingBox box); // Detect collision between ray and box //------------------------------------------------------------------------------------ +// Ray Casts +//------------------------------------------------------------------------------------ +RLAPI RayHitInfo RaycastGroundPlane( Ray ray, float groundHeight ); +RLAPI RayHitInfo RaycastTriangle( Ray ray, Vector3 a, Vector3 b, Vector3 c ); +RLAPI RayHitInfo RaycastMesh( Ray ray, Mesh *mesh ); + +//------------------------------------------------------------------------------------ // Shaders System Functions (Module: rlgl) // NOTE: This functions are useless when using OpenGL 1.1 //------------------------------------------------------------------------------------ |
