ksys/phys: Add RayCastPlusBody

This commit is contained in:
Léo Lam
2022-03-21 00:21:15 +01:00
parent 0890d161e5
commit eca996b3fa
4 changed files with 66 additions and 10 deletions
+2
View File
@@ -145,6 +145,8 @@ target_sources(uking PRIVATE
System/physQueryContactPointInfo.h
System/physRayCast.cpp
System/physRayCast.h
System/physRayCastPlusBody.cpp
System/physRayCastPlusBody.h
System/physSensorContactListener.cpp
System/physSensorContactListener.h
System/physSensorGroupFilter.cpp
@@ -0,0 +1,29 @@
#include "KingSystem/Physics/System/physRayCastPlusBody.h"
namespace ksys::phys {
RayCastPlusBody::RayCastPlusBody(SystemGroupHandler* group_handler, GroundHit ground_hit)
: RayCast(group_handler, ground_hit) {}
RayCastPlusBody::~RayCastPlusBody() = default;
bool RayCastPlusBody::worldRayCast(ContactLayerType layer_type) {
mHitRigidBody = nullptr;
return RayCast::worldRayCast(layer_type);
}
bool RayCastPlusBody::shapeRayCast(RigidBody* rigid_body) {
mHitRigidBody = nullptr;
return RayCast::shapeRayCast(rigid_body);
}
bool RayCastPlusBody::phantomRayCast(Phantom* phantom) {
mHitRigidBody = nullptr;
return RayCast::phantomRayCast(phantom);
}
void RayCastPlusBody::onRigidBodyHit(RigidBody* body) {
mHitRigidBody = body;
}
} // namespace ksys::phys
@@ -0,0 +1,25 @@
#pragma once
#include "KingSystem/Physics/System/physRayCast.h"
namespace ksys::phys {
class RayCastPlusBody : public RayCast {
SEAD_RTTI_OVERRIDE(RayCastPlusBody, RayCast)
public:
RayCastPlusBody(SystemGroupHandler* group_handler, GroundHit ground_hit);
~RayCastPlusBody() 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