mirror of
https://github.com/zeldaret/botw
synced 2026-07-08 13:46:25 -04:00
ksys/phys: Start adding ClosestPointQuery and iterator stuff
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#include "KingSystem/Physics/System/physClosestPointQuery.h"
|
||||
#include "KingSystem/Physics/RigidBody/physRigidBody.h"
|
||||
#include "KingSystem/Physics/System/physQueryContactPointInfo.h"
|
||||
#include "KingSystem/Physics/physDefines.h"
|
||||
#include "KingSystem/Physics/physLayerMaskBuilder.h"
|
||||
|
||||
namespace ksys::phys {
|
||||
|
||||
ClosestPointQuery::ClosestPointQuery(RigidBody* body, QueryContactPointInfo* contact_point_info)
|
||||
: mBody(body), mContactPointInfo(contact_point_info) {
|
||||
reset();
|
||||
}
|
||||
|
||||
ClosestPointQuery::~ClosestPointQuery() = default;
|
||||
|
||||
void ClosestPointQuery::reset() {
|
||||
mIsSuccess = false;
|
||||
_18 = 0;
|
||||
}
|
||||
|
||||
void ClosestPointQuery::setLayerMasks(const LayerMaskBuilder& builder) {
|
||||
auto* info = mContactPointInfo;
|
||||
for (int i = 0; i < NumContactLayerTypes; ++i) {
|
||||
info->mSubscribedLayers[i] = builder.getMasks()[i].layers;
|
||||
info->mLayerMask2[i] = builder.getMasks()[i].layers2;
|
||||
}
|
||||
}
|
||||
|
||||
bool ClosestPointQuery::isSuccess() const {
|
||||
return mIsSuccess;
|
||||
}
|
||||
|
||||
void ClosestPointQuery::setLayerMasksAndBodyCollisionFilterInfo(const LayerMaskBuilder& builder) {
|
||||
EntityCollisionMask mask;
|
||||
mask.data.query_custom_receiver_layer_mask =
|
||||
builder.getMasks()[int(ContactLayerType::Entity)].layers;
|
||||
mask.data.layer = ContactLayer::EntityQueryCustomReceiver;
|
||||
mBody->setCollisionFilterInfo(mask.raw);
|
||||
|
||||
setLayerMasks(builder);
|
||||
}
|
||||
|
||||
} // namespace ksys::phys
|
||||
Reference in New Issue
Block a user