From 8f7552f96ea37d1e0f8e1279f804a903367c2a33 Mon Sep 17 00:00:00 2001 From: "William Powell \"wmpowell8" <88069370+wmpowell8@users.noreply.github.com> Date: Mon, 13 Jun 2022 12:40:35 -0700 Subject: [PATCH] Add more constructor overloads for RayCollision Not all `GetRayCollision` functions are abstracted by `raylib::RayCollision` constructors. This pull request provides these abstractions for the rest of these functions. --- include/RayCollision.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/RayCollision.hpp b/include/RayCollision.hpp index 18f9b724..98111b79 100644 --- a/include/RayCollision.hpp +++ b/include/RayCollision.hpp @@ -19,6 +19,13 @@ class RayCollision : public ::RayCollision { // Nothing. } + /** + * Get collision info between ray and bounding box + */ + RayCollision(const ::Ray& ray, const ::BoundingBox& box) { + set(::GetRayCollisionBox(ray, box)); + } + /** * Get collision info between ray and mesh */ @@ -33,6 +40,20 @@ class RayCollision : public ::RayCollision { set(::GetRayCollisionModel(ray, model)); } + /** + * Get collision info between ray and quad + */ + RayCollision(const ::Ray& ray, ::Vector3 p1, ::Vector3 p2, ::Vector3 p3, ::Vector3 p4) { + set(::GetRayCollisionQuad(ray, p1, p2, p3, p4)); + } + + /** + * Get collision info between ray and sphere + */ + RayCollision(const ::Ray& ray, ::Vector3 center, float radius) { + set(::GetRayCollisionSphere(ray, center, radius)); + } + /** * Get collision info between ray and triangle */