Physics3D: Add raycast support

This commit is contained in:
SirLynix
2023-03-14 18:03:05 +01:00
committed by Jérôme Leclercq
parent 5ee25e9621
commit 522315dbca
4 changed files with 90 additions and 13 deletions

View File

@@ -39,6 +39,8 @@ namespace Nz
std::size_t GetMaxStepCount() const;
Time GetStepSize() const;
bool RaycastQueryFirst(const Vector3f& from, const Vector3f& to, RaycastHit* hitInfo = nullptr);
void SetGravity(const Vector3f& gravity);
void SetMaxStepCount(std::size_t maxStepCount);
void SetStepSize(Time stepSize);
@@ -51,7 +53,7 @@ namespace Nz
struct RaycastHit
{
float fraction;
RigidBody3D* hitBody;
RigidBody3D* hitBody = nullptr;
Vector3f hitPosition;
Vector3f hitNormal;
};