From eca996b3fa362abd7b7199ca47b8d03762753d14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Mon, 21 Mar 2022 00:21:15 +0100 Subject: [PATCH] ksys/phys: Add RayCastPlusBody --- data/uking_functions.csv | 20 ++++++------- src/KingSystem/Physics/CMakeLists.txt | 2 ++ .../Physics/System/physRayCastPlusBody.cpp | 29 +++++++++++++++++++ .../Physics/System/physRayCastPlusBody.h | 25 ++++++++++++++++ 4 files changed, 66 insertions(+), 10 deletions(-) create mode 100644 src/KingSystem/Physics/System/physRayCastPlusBody.cpp create mode 100644 src/KingSystem/Physics/System/physRayCastPlusBody.h diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 816314b2..729bc1f2 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -84055,16 +84055,16 @@ Address,Quality,Size,Name 0x0000007100fc5218,O,000112,_ZNK4ksys4phys7RayCast27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE 0x0000007100fc5288,O,000092,_ZNK4ksys4phys7RayCast18getRuntimeTypeInfoEv 0x0000007100fc52e4,O,000004,_ZN4ksys4phys7RayCast14onRigidBodyHitEPNS0_9RigidBodyE -0x0000007100fc52e8,U,000056,phys::RayCastDerived::ctor -0x0000007100fc5320,U,000004,phys::RayCastDerived::dtor -0x0000007100fc5324,U,000036,phys::RayCastDerived::dtord -0x0000007100fc5348,U,000008,phys::RayCastDerived::worldRayCast -0x0000007100fc5350,U,000008,phys::RayCastDerived::shapeRayCast -0x0000007100fc5358,U,000008,phys::RayCastDerived::phantomRayCast -0x0000007100fc5360,U,000008,phys::RayCastDerived::m4 -0x0000007100fc5368,U,000204,phys::RayCastDerived::rtti1 -0x0000007100fc5434,U,000092,phys::RayCastDerived::rtti2 -0x0000007100fc5490,U,000140,sead_rtti_phys::RayCast +0x0000007100fc52e8,O,000056,_ZN4ksys4phys15RayCastPlusBodyC1EPNS0_18SystemGroupHandlerENS0_9GroundHitE +0x0000007100fc5320,O,000004,_ZN4ksys4phys15RayCastPlusBodyD1Ev +0x0000007100fc5324,O,000036,_ZN4ksys4phys15RayCastPlusBodyD0Ev +0x0000007100fc5348,O,000008,_ZN4ksys4phys15RayCastPlusBody12worldRayCastENS0_16ContactLayerTypeE +0x0000007100fc5350,O,000008,_ZN4ksys4phys15RayCastPlusBody12shapeRayCastEPNS0_9RigidBodyE +0x0000007100fc5358,O,000008,_ZN4ksys4phys15RayCastPlusBody14phantomRayCastEPNS0_7PhantomE +0x0000007100fc5360,O,000008,_ZN4ksys4phys15RayCastPlusBody14onRigidBodyHitEPNS0_9RigidBodyE +0x0000007100fc5368,O,000204,_ZNK4ksys4phys15RayCastPlusBody27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE +0x0000007100fc5434,O,000092,_ZNK4ksys4phys15RayCastPlusBody18getRuntimeTypeInfoEv +0x0000007100fc5490,O,000140,_ZNK4sead15RuntimeTypeInfo6DeriveIN4ksys4phys7RayCastEE9isDerivedEPKNS0_9InterfaceE 0x0000007100fc551c,U,000076,phys::RayCastDerived2::ctor 0x0000007100fc5568,U,000004,phys::RayCastDerived2::dtor 0x0000007100fc556c,U,000036,phys::RayCastDerived2::dtord diff --git a/src/KingSystem/Physics/CMakeLists.txt b/src/KingSystem/Physics/CMakeLists.txt index a3e2aaf1..f70aee39 100644 --- a/src/KingSystem/Physics/CMakeLists.txt +++ b/src/KingSystem/Physics/CMakeLists.txt @@ -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 diff --git a/src/KingSystem/Physics/System/physRayCastPlusBody.cpp b/src/KingSystem/Physics/System/physRayCastPlusBody.cpp new file mode 100644 index 00000000..d32e6d5a --- /dev/null +++ b/src/KingSystem/Physics/System/physRayCastPlusBody.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 diff --git a/src/KingSystem/Physics/System/physRayCastPlusBody.h b/src/KingSystem/Physics/System/physRayCastPlusBody.h new file mode 100644 index 00000000..daceddb8 --- /dev/null +++ b/src/KingSystem/Physics/System/physRayCastPlusBody.h @@ -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