diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 72d82f16..9bd3cef8 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -84010,8 +84010,8 @@ Address,Quality,Size,Name 0x0000007100fc3330,O,000068,_ZN4ksys4phys21QueryContactPointInfo4freeEPS1_ 0x0000007100fc3374,O,000004,_ZN4ksys4phys21QueryContactPointInfoD1Ev 0x0000007100fc3378,O,000036,_ZN4ksys4phys21QueryContactPointInfoD0Ev -0x0000007100fc339c,U,000088,QueryContactPointInfo::Iterator::x_1 -0x0000007100fc33f4,U,000068,QueryContactPointInfo::Iterator::x_2 +0x0000007100fc339c,M,000088,_ZNK4ksys4phys21QueryContactPointInfo8Iterator14getHitPositionEPN4sead7Vector3IfEERKNS0_9ShapeCastE +0x0000007100fc33f4,M,000068,_ZNK4ksys4phys21QueryContactPointInfo8Iterator14getHitPositionERKNS0_9ShapeCastE 0x0000007100fc3438,O,000032,_ZNK4ksys4phys21QueryContactPointInfo8Iterator16getPointPositionEPN4sead7Vector3IfEENS0_16ContactPointInfo8Iterator5PointE 0x0000007100fc3458,O,000056,_ZNK4ksys4phys21QueryContactPointInfo8Iterator16getPointPositionENS0_16ContactPointInfo8Iterator5PointE 0x0000007100fc3490,M,000284,_ZN4ksys4phys7RayCastC1EPNS0_18SystemGroupHandlerENS0_9GroundHitE diff --git a/src/KingSystem/Physics/System/physQueryContactPointInfo.cpp b/src/KingSystem/Physics/System/physQueryContactPointInfo.cpp index c5098227..121e2c25 100644 --- a/src/KingSystem/Physics/System/physQueryContactPointInfo.cpp +++ b/src/KingSystem/Physics/System/physQueryContactPointInfo.cpp @@ -1,5 +1,6 @@ #include "KingSystem/Physics/System/physQueryContactPointInfo.h" #include "KingSystem/Physics/System/physContactMgr.h" +#include "KingSystem/Physics/System/physShapeCast.h" namespace ksys::phys { @@ -17,6 +18,21 @@ void QueryContactPointInfo::free(QueryContactPointInfo* info) { QueryContactPointInfo::~QueryContactPointInfo() = default; +// NON_MATCHING: reordering +void QueryContactPointInfo::Iterator::getHitPosition(sead::Vector3f* out, + const ShapeCast& shape_cast) const { + float distance = getPoint()->separating_distance; + auto start = shape_cast.getStart(); + auto end = shape_cast.getEnd(); + *out = start + (end - start) * distance; +} + +sead::Vector3f QueryContactPointInfo::Iterator::getHitPosition(const ShapeCast& shape_cast) const { + sead::Vector3f pos; + getHitPosition(&pos, shape_cast); + return pos; +} + void QueryContactPointInfo::Iterator::getPointPosition(sead::Vector3f* out, Point point) const { out->e = getPoint()->position.e; } diff --git a/src/KingSystem/Physics/System/physQueryContactPointInfo.h b/src/KingSystem/Physics/System/physQueryContactPointInfo.h index c28039ac..2058b9af 100644 --- a/src/KingSystem/Physics/System/physQueryContactPointInfo.h +++ b/src/KingSystem/Physics/System/physQueryContactPointInfo.h @@ -4,12 +4,17 @@ namespace ksys::phys { +class ShapeCast; + class QueryContactPointInfo : public ContactPointInfo { public: class Iterator : public ContactPointInfo::Iterator { public: using ContactPointInfo::Iterator::Iterator; + void getHitPosition(sead::Vector3f* out, const ShapeCast& shape_cast) const; + sead::Vector3f getHitPosition(const ShapeCast& shape_cast) const; + void getPointPosition(sead::Vector3f* out, Point point) const override; sead::Vector3f getPointPosition(Point point) const override; }; diff --git a/src/KingSystem/Physics/System/physShapeCast.h b/src/KingSystem/Physics/System/physShapeCast.h index 85927677..694801d6 100644 --- a/src/KingSystem/Physics/System/physShapeCast.h +++ b/src/KingSystem/Physics/System/physShapeCast.h @@ -47,6 +47,8 @@ public: void setRotation(const sead::Matrix33f& rotation_matrix); void setRotation(const sead::Matrix34f& transform_matrix); + const sead::Vector3f& getStart() const { return mFrom; } + const sead::Vector3f& getEnd() const { return mTo; } void setStartAndEnd(const sead::Vector3f& start, const sead::Vector3f& end); void setStartAndDisplacement(const sead::Vector3f& start, const sead::Vector3f& displacement); void setStartAndDisplacementScaled(const sead::Vector3f& start,