summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/KingSystem/ActorSystem/actPhysicsUserTag.h2
-rw-r--r--src/KingSystem/Physics/RigidBody/physRigidBody.cpp2
-rw-r--r--src/KingSystem/Physics/RigidBody/physRigidBody.h13
-rw-r--r--src/KingSystem/Physics/System/physUserTag.cpp5
-rw-r--r--src/KingSystem/Physics/System/physUserTag.h5
5 files changed, 19 insertions, 8 deletions
diff --git a/src/KingSystem/ActorSystem/actPhysicsUserTag.h b/src/KingSystem/ActorSystem/actPhysicsUserTag.h
index d076c15e..641cd0f2 100644
--- a/src/KingSystem/ActorSystem/actPhysicsUserTag.h
+++ b/src/KingSystem/ActorSystem/actPhysicsUserTag.h
@@ -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;
diff --git a/src/KingSystem/Physics/RigidBody/physRigidBody.cpp b/src/KingSystem/Physics/RigidBody/physRigidBody.cpp
index b4daedec..de1b1af3 100644
--- a/src/KingSystem/Physics/RigidBody/physRigidBody.cpp
+++ b/src/KingSystem/Physics/RigidBody/physRigidBody.cpp
@@ -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);
diff --git a/src/KingSystem/Physics/RigidBody/physRigidBody.h b/src/KingSystem/Physics/RigidBody/physRigidBody.h
index 7cdd1514..3375e9d5 100644
--- a/src/KingSystem/Physics/RigidBody/physRigidBody.h
+++ b/src/KingSystem/Physics/RigidBody/physRigidBody.h
@@ -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.
diff --git a/src/KingSystem/Physics/System/physUserTag.cpp b/src/KingSystem/Physics/System/physUserTag.cpp
index 03f0fcb8..99a05991 100644
--- a/src/KingSystem/Physics/System/physUserTag.cpp
+++ b/src/KingSystem/Physics/System/physUserTag.cpp
@@ -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) {
diff --git a/src/KingSystem/Physics/System/physUserTag.h b/src/KingSystem/Physics/System/physUserTag.h
index 5942ee45..247d7c00 100644
--- a/src/KingSystem/Physics/System/physUserTag.h
+++ b/src/KingSystem/Physics/System/physUserTag.h
@@ -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);