summaryrefslogtreecommitdiff
path: root/src/KingSystem/Physics/RigidBody/physRigidBodyAccessor.h
blob: af47cac426f053ea4882caee550805b23b290612 (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
#pragma once

#include <math/seadMatrix.h>
#include <math/seadQuat.h>
#include <math/seadVector.h>
#include "KingSystem/Physics/physDefines.h"

class hkpRigidBody;

namespace ksys::phys {

class RigidBodyAccessor {
public:
    explicit RigidBodyAccessor(hkpRigidBody* body);
    virtual ~RigidBodyAccessor();

    hkpRigidBody* getBody() const { return mBody; }

    MotionType getMotionType() const;

    void getPosition(sead::Vector3f* pos) const;
    void getRotation(sead::Quatf* rot) const;
    void getTransform(sead::Matrix34f* mtx) const;

    void getLinearVelocity(sead::Vector3f* vel) const;
    void getAngularVelocity(sead::Vector3f* vel) const;

    /// Whether `vel` >= abs(c) for each component c of the linear velocity and angular velocity.
    // XXX: does this function even make sense? We're comparing `vel` against two quantities
    // that have different units!
    bool isVelocityGreaterEqual(float vel) const;

    void getPointVelocity(sead::Vector3f* vel, const sead::Vector3f& point) const;

    float getTimeFactor() const;

    /// Both parameters are allowed to be null.
    void getDeltaCenterOfMass(sead::Vector3f* out_delta_pos, sead::Vector3f* out_delta_angle) const;

private:
    hkpRigidBody* mBody;
};

}  // namespace ksys::phys