summaryrefslogtreecommitdiff
path: root/src/KingSystem/Physics/System/physRayCastBodyQuery.h
blob: ee0a65df9056fd1b66cc3a0aa2006f752557ab4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#pragma once

#include "KingSystem/Physics/System/physRayCast.h"

namespace ksys::phys {

/// A RayCast that keeps track of the first rigid body that collided with the ray (if any).
class RayCastBodyQuery : public RayCast {
    SEAD_RTTI_OVERRIDE(RayCastBodyQuery, RayCast)
public:
    RayCastBodyQuery(SystemGroupHandler* group_handler, GroundHit ground_hit);
    ~RayCastBodyQuery() override;

    bool worldRayCast(ContactLayerType layer_type);
    bool shapeRayCast(RigidBody* rigid_body);
    bool phantomRayCast(Phantom* phantom);

    RigidBody* getHitRigidBody() const { return mHitRigidBody; }

    void onRigidBodyHit(RigidBody* body) override;

private:
    RigidBody* mHitRigidBody{};
};

}  // namespace ksys::phys