1#ifndef RAYLIB_CPP_INCLUDE_BOUNDINGBOX_HPP_
2#define RAYLIB_CPP_INCLUDE_BOUNDINGBOX_HPP_
4#include "./raylib-cpp-utils.hpp"
5#include "./RayCollision.hpp"
16 BoundingBox(const ::BoundingBox& box) : ::BoundingBox{box.min, box.max} {
23 BoundingBox(const ::Mesh& mesh) { set(::GetMeshBoundingBox(mesh)); }
25 BoundingBox(::Vector3 minMax = ::Vector3{0.0f, 0.0f, 0.0f}) : ::BoundingBox{minMax, minMax} {}
26 BoundingBox(::Vector3 min, ::Vector3 max) : ::BoundingBox{min, max} {}
28 GETTERSETTER(::Vector3, Min, min)
39 void Draw(::Color color = {255, 255, 255, 255})
const { ::DrawBoundingBox(*
this, color); }
44 [[nodiscard]]
bool CheckCollision(const ::BoundingBox& box2)
const {
return CheckCollisionBoxes(*
this, box2); }
49 [[nodiscard]]
bool CheckCollision(::Vector3 center,
float radius)
const {
return CheckCollisionBoxSphere(*
this, center, radius); }
54 [[nodiscard]]
bool CheckCollision(const ::Ray& ray)
const {
return GetRayCollisionBox(ray, *
this).hit; }
61 void set(const ::BoundingBox& box) {
65 void set(const ::Vector3& _min, const ::Vector3& _max) {
bool CheckCollision(::Vector3 center, float radius) const
Detect collision between box and sphere.
RayCollision GetCollision(const ::Ray &ray) const
Get collision information between ray and bounding box.
BoundingBox(const ::Mesh &mesh)
Compute mesh bounding box limits.
void Draw(::Color color={255, 255, 255, 255}) const
Draw a bounding box with wires.
bool CheckCollision(const ::BoundingBox &box2) const
Detect collision between two boxes.
bool CheckCollision(const ::Ray &ray) const
Detect collision between ray and bounding box.
All raylib-cpp classes and functions appear in the raylib namespace.