blob: 51f7d4d0e0d6376076d8ad7ba10de7b0f906a185 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#pragma once
#include <basis/seadTypes.h>
#include <math/seadMatrix.h>
#include <math/seadQuat.h>
#include <math/seadVector.h>
#include "KingSystem/Physics/RigidBody/physRigidBody.h"
class hkQuaternionf;
class hkVector4f;
class hkpMotion;
namespace ksys::phys {
struct RigidBodyInstanceParam;
class MotionAccessor {
SEAD_RTTI_BASE(MotionAccessor)
public:
explicit MotionAccessor(RigidBody* body);
MotionType getMotionType() const;
hkpMotion* getRigidBodyMotion() const;
void setMotionFlag(RigidBody::MotionFlag flag);
bool hasMotionFlagSet(RigidBody::MotionFlag flag) const;
bool hasMotionFlagDisabled(RigidBody::MotionFlag flag) const;
void disableMotionFlag(RigidBody::MotionFlag flag);
virtual void setTransform(const sead::Matrix34f& mtx, bool propagate_to_linked_motions) = 0;
virtual void setPosition(const sead::Vector3f& position, bool propagate_to_linked_motions) = 0;
virtual void getPosition(sead::Vector3f* position) = 0;
virtual void getRotation(sead::Quatf* rotation) = 0;
virtual void getTransform(sead::Matrix34f* mtx) = 0;
virtual void setCenterOfMassInLocal(const sead::Vector3f& center) = 0;
virtual void getCenterOfMassInLocal(sead::Vector3f* center) = 0;
virtual bool setLinearVelocity(const sead::Vector3f& velocity, float epsilon) = 0;
virtual bool setLinearVelocity(const hkVector4f& velocity, float epsilon) = 0;
virtual void getLinearVelocity(sead::Vector3f* velocity) = 0;
virtual bool setAngularVelocity(const sead::Vector3f& velocity, float epsilon) = 0;
virtual bool setAngularVelocity(const hkVector4f& velocity, float epsilon) = 0;
virtual void getAngularVelocity(sead::Vector3f* velocity) = 0;
virtual void setMaxLinearVelocity(float max) = 0;
virtual float getMaxLinearVelocity() = 0;
virtual void setMaxAngularVelocity(float max) = 0;
virtual float getMaxAngularVelocity() = 0;
virtual ~MotionAccessor();
virtual bool init(const RigidBodyInstanceParam& params, sead::Heap* heap) = 0;
virtual void getRotation(hkQuaternionf* quat) = 0;
virtual void setTimeFactor(float factor) = 0;
virtual float getTimeFactor() = 0;
virtual void freeze(bool freeze, bool preserve_velocities, bool preserve_max_impulse) = 0;
virtual void resetFrozenState() = 0;
RigidBody* getBody() const { return mBody; }
hkpRigidBody* getHkBody() const { return mBody->getHkBody(); }
u32 get10() const { return _10; }
u32 get14() const { return _14; }
void increment10() { ++_10; }
void increment14() { ++_14; }
protected:
RigidBody* mBody = nullptr;
u32 _10 = 0;
u32 _14 = 0;
};
} // namespace ksys::phys
|