Path: blob/master/thirdparty/jolt_physics/Jolt/Physics/Collision/CastResult.h
9912 views
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)1// SPDX-FileCopyrightText: 2021 Jorrit Rouwe2// SPDX-License-Identifier: MIT34#pragma once56#include <Jolt/Physics/Body/BodyID.h>7#include <Jolt/Physics/Collision/Shape/SubShapeID.h>89JPH_NAMESPACE_BEGIN1011/// Structure that holds a ray cast or other object cast hit12class BroadPhaseCastResult13{14public:15JPH_OVERRIDE_NEW_DELETE1617/// Function required by the CollisionCollector. A smaller fraction is considered to be a 'better hit'. For rays/cast shapes we can just use the collision fraction.18inline float GetEarlyOutFraction() const { return mFraction; }1920/// Reset this result so it can be reused for a new cast.21inline void Reset() { mBodyID = BodyID(); mFraction = 1.0f + FLT_EPSILON; }2223BodyID mBodyID; ///< Body that was hit24float mFraction = 1.0f + FLT_EPSILON; ///< Hit fraction of the ray/object [0, 1], HitPoint = Start + mFraction * (End - Start)25};2627/// Specialization of cast result against a shape28class RayCastResult : public BroadPhaseCastResult29{30public:31JPH_OVERRIDE_NEW_DELETE3233SubShapeID mSubShapeID2; ///< Sub shape ID of shape that we collided against34};3536JPH_NAMESPACE_END373839