ksys/phys: Rename RigidBody/UserTag broadphase border callbacks

This commit is contained in:
Léo Lam
2022-01-29 12:36:59 +01:00
parent 10d3f129b0
commit 61201ca54b
6 changed files with 21 additions and 10 deletions
@@ -18,7 +18,7 @@ public:
Actor* getActor(ActorLinkConstDataAccess* accessor, Actor* other_actor) const;
bool acquireActor(ActorLinkConstDataAccess* accessor) const;
void m2(void* a) override;
void onMaxPositionExceeded(phys::RigidBody* body) override;
void m3(void* a, void* b, float c) override;
void onBodyShapeChanged(phys::RigidBody* body) override;
void m5() override;
@@ -1746,7 +1746,7 @@ void* RigidBody::m11() {
return nullptr;
}
void RigidBody::resetPosition() {
void RigidBody::onMaxPositionExceeded() {
// debug logging?
[[maybe_unused]] sead::Vector3f position = getPosition();
setPosition(sead::Vector3f::zero, true);
@@ -456,7 +456,7 @@ public:
void setMotionFlag(MotionFlag flag);
hkpRigidBody* getHkBody() const { return mHkBody; }
UserTag* getUserTag() const { return mUserTag; }
Type getType() const { return mType; }
bool isCharacterControllerType() const { return mType == Type::CharacterController; }
@@ -498,7 +498,16 @@ public:
virtual const hkpShape* getNewShape();
virtual void* m11();
virtual float m12(float x, float y);
virtual void resetPosition();
/// Called when the rigid body goes beyond the broadphase border.
///
/// Note: this is not guaranteed to be called if we have a user tag.
/// The tag may choose not to invoke this callback.
///
/// The default implementation just resets the position to the origin.
virtual void onMaxPositionExceeded();
/// Get the name of this rigid body or its user.
virtual const char* getName();
// Internal.
@@ -1,9 +1,10 @@
#include "KingSystem/Physics/System/physUserTag.h"
#include "KingSystem/Physics/RigidBody/physRigidBody.h"
namespace ksys::phys {
void UserTag::m2(void* a) {
// FIXME
void UserTag::onMaxPositionExceeded(RigidBody* body) {
body->onMaxPositionExceeded();
}
void UserTag::m3(void* a, void* b, float c) {
+3 -2
View File
@@ -13,8 +13,9 @@ class UserTag {
public:
UserTag() = default;
// FIXME: names and types
virtual void m2(void* a);
/// Called when a rigid body goes beyond the broadphase border.
/// The default implementation just notifies the rigid body of this callback.
virtual void onMaxPositionExceeded(RigidBody* body);
// a and b are probably physics bodies?
virtual void m3(void* a, void* b, float c);
virtual void onBodyShapeChanged(RigidBody* body);