mirror of https://github.com/zeldaret/botw.git
ksys/phys: Use named bools in RigidBody to improve call site readability
This commit is contained in:
parent
294666ba13
commit
7934e14ad6
|
@ -82992,9 +82992,9 @@ Address,Quality,Size,Name
|
|||
0x0000007100f8e3fc,U,000816,phys::RigidBody::x_11
|
||||
0x0000007100f8e72c,O,000136,_ZN4ksys4phys9RigidBody16setCollisionInfoEPNS0_13CollisionInfoE
|
||||
0x0000007100f8e7b4,O,000052,_ZN4ksys4phys9RigidBody19setContactPointInfoEPNS0_16ContactPointInfoE
|
||||
0x0000007100f8e7e8,O,000264,_ZN4ksys4phys9RigidBody26setFixedAndPreserveImpulseEbb
|
||||
0x0000007100f8e8f0,O,000460,_ZN4ksys4phys9RigidBody6freezeEbbb
|
||||
0x0000007100f8eabc,O,000384,_ZN4ksys4phys9RigidBody8setFixedEbb
|
||||
0x0000007100f8e7e8,O,000264,_ZN4ksys4phys9RigidBody26setFixedAndPreserveImpulseENS0_5FixedENS0_20MarkLinearVelAsDirtyE
|
||||
0x0000007100f8e8f0,O,000460,_ZN4ksys4phys9RigidBody6freezeENS0_12ShouldFreezeENS0_18PreserveVelocitiesENS0_18PreserveMaxImpulseE
|
||||
0x0000007100f8eabc,O,000384,_ZN4ksys4phys9RigidBody8setFixedENS0_5FixedENS0_18PreserveVelocitiesE
|
||||
0x0000007100f8ec3c,O,000312,_ZN4ksys4phys9RigidBody17setLinearVelocityERKN4sead7Vector3IfEEf
|
||||
0x0000007100f8ed74,O,000196,_ZN4ksys4phys9RigidBody18setAngularVelocityERKN4sead7Vector3IfEEf
|
||||
0x0000007100f8ee38,O,000024,_ZN4ksys4phys9RigidBody16resetFrozenStateEv
|
||||
|
@ -83026,8 +83026,8 @@ Address,Quality,Size,Name
|
|||
0x0000007100f8faa0,O,000056,_ZN4ksys4phys9RigidBody28addGroundTypeToGroundHitMaskENS0_9GroundHitE
|
||||
0x0000007100f8fad8,O,000044,_ZNK4ksys4phys9RigidBody16getGroundHitTypeEv
|
||||
0x0000007100f8fb04,O,000004,_ZN4ksys4phys9RigidBody8setColorERKN4sead7Color4fEPKvb
|
||||
0x0000007100f8fb08,O,000360,_ZN4ksys4phys9RigidBody12setTransformERKN4sead8Matrix34IfEEb
|
||||
0x0000007100f8fc70,O,000196,_ZN4ksys4phys9RigidBody11setPositionERKN4sead7Vector3IfEEb
|
||||
0x0000007100f8fb08,O,000360,_ZN4ksys4phys9RigidBody12setTransformERKN4sead8Matrix34IfEENS0_24PropagateToLinkedMotionsE
|
||||
0x0000007100f8fc70,O,000196,_ZN4ksys4phys9RigidBody11setPositionERKN4sead7Vector3IfEENS0_24PropagateToLinkedMotionsE
|
||||
0x0000007100f8fd34,O,000012,_ZNK4ksys4phys9RigidBody16isTransformDirtyEv
|
||||
0x0000007100f8fd40,O,000124,_ZN4ksys4phys9RigidBody8setScaleEf
|
||||
0x0000007100f8fdbc,O,000328,_ZN4ksys4phys9RigidBody11updateShapeEv
|
||||
|
@ -83052,13 +83052,13 @@ Address,Quality,Size,Name
|
|||
0x0000007100f91378,O,000040,_ZNK4ksys4phys9RigidBody22getCenterOfMassInWorldEv
|
||||
0x0000007100f913a0,O,000992,_ZN4ksys4phys9RigidBody25changePositionAndRotationERKN4sead8Matrix34IfEEf
|
||||
0x0000007100f91780,O,000672,_ZN4ksys4phys9RigidBody17computeVelocitiesEP10hkVector4fS3_RKS2_RK13hkQuaternionff
|
||||
0x0000007100f91a20,O,000580,_ZN4ksys4phys9RigidBody14changePositionERKN4sead7Vector3IfEEbf
|
||||
0x0000007100f91a20,O,000580,_ZN4ksys4phys9RigidBody14changePositionERKN4sead7Vector3IfEENS0_19KeepAngularVelocityEf
|
||||
0x0000007100f91c64,O,000536,_ZN4ksys4phys9RigidBody14changeRotationERKN4sead4QuatIfEEf
|
||||
0x0000007100f91e7c,O,000656,_ZN4ksys4phys9RigidBody14changeRotationERKN4sead8Matrix34IfEEf
|
||||
0x0000007100f9210c,O,000968,_ZN4ksys4phys9RigidBody17computeVelocitiesEPN4sead7Vector3IfEES5_RKNS2_8Matrix34IfEE
|
||||
0x0000007100f924d4,O,000644,_ZNK4ksys4phys9RigidBody22computeAngularVelocityEPN4sead7Vector3IfEERKNS2_8Matrix34IfEE
|
||||
0x0000007100f92758,O,000528,_ZNK4ksys4phys9RigidBody22computeAngularVelocityEPN4sead7Vector3IfEERKNS2_4QuatIfEE
|
||||
0x0000007100f92968,O,000524,_ZNK4ksys4phys9RigidBody21computeLinearVelocityEPN4sead7Vector3IfEERKS4_b
|
||||
0x0000007100f92968,O,000524,_ZNK4ksys4phys9RigidBody21computeLinearVelocityEPN4sead7Vector3IfEERKS4_NS0_30TakeAngularVelocityIntoAccountE
|
||||
0x0000007100f92b74,O,000140,_ZN4ksys4phys9RigidBody17computeVelocitiesEP10hkVector4fS3_RKS2_RK13hkQuaternionf
|
||||
0x0000007100f92c00,O,000128,_ZN4ksys4phys9RigidBody22setCenterOfMassInLocalERKN4sead7Vector3IfEE
|
||||
0x0000007100f92c80,O,000016,_ZNK4ksys4phys9RigidBody22getCenterOfMassInLocalEPN4sead7Vector3IfEE
|
||||
|
@ -83493,12 +83493,12 @@ Address,Quality,Size,Name
|
|||
0x0000007100fa8d24,O,000044,_ZN4ksys4phys12RigidBodySetC1ERKN4sead14SafeStringBaseIcEE
|
||||
0x0000007100fa8d50,O,000020,_ZN4ksys4phys12RigidBodySetD1Ev
|
||||
0x0000007100fa8d64,O,000004,_ZN4ksys4phys12RigidBodySetD0Ev
|
||||
0x0000007100fa8d68,O,000080,_ZN4ksys4phys12RigidBodySet26setFixedAndPreserveImpulseEbb
|
||||
0x0000007100fa8d68,O,000080,_ZN4ksys4phys12RigidBodySet26setFixedAndPreserveImpulseENS0_5FixedENS0_20MarkLinearVelAsDirtyE
|
||||
0x0000007100fa8db8,O,000056,_ZN4ksys4phys12RigidBodySet16resetFrozenStateEv
|
||||
0x0000007100fa8df0,O,000180,_ZN4ksys4phys12RigidBodySet22setUseSystemTimeFactorEb
|
||||
0x0000007100fa8ea4,O,000180,_ZN4ksys4phys12RigidBodySet15clearFlag400000Eb
|
||||
0x0000007100fa8f58,O,000072,_ZN4ksys4phys12RigidBodySet22setEntityMotionFlag200Eb
|
||||
0x0000007100fa8fa0,O,000080,_ZN4ksys4phys12RigidBodySet8setFixedEbb
|
||||
0x0000007100fa8fa0,O,000080,_ZN4ksys4phys12RigidBodySet8setFixedENS0_5FixedENS0_18PreserveVelocitiesE
|
||||
0x0000007100fa8ff0,O,000056,_ZN4ksys4phys12RigidBodySet28updateMotionTypeRelatedFlagsEv
|
||||
0x0000007100fa9028,O,000056,_ZN4ksys4phys12RigidBodySet32triggerScheduledMotionTypeChangeEv
|
||||
0x0000007100fa9060,O,000084,_ZNK4ksys4phys12RigidBodySet19hasActiveEntityBodyEv
|
||||
|
|
Can't render this file because it is too large.
|
|
@ -33,7 +33,7 @@ void KorokTargetMove::calc_() {
|
|||
auto* actor = mActor;
|
||||
auto* body = actor->getMainBody();
|
||||
if (*mIsBezier_d || *mIsTargetWarp_m) {
|
||||
body->setPosition(*mTargetPos_d, true);
|
||||
body->setPosition(*mTargetPos_d);
|
||||
setFinished();
|
||||
return;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ void KorokTargetMove::calc_() {
|
|||
sead::Vector3f pos(mtx(0, 3), mtx(1, 3), mtx(2, 3));
|
||||
|
||||
ksys::VFR::chaseVec(&pos, *mTargetPos_d, *mSpeed_d);
|
||||
body->changePosition(pos, true);
|
||||
body->changePosition(pos, ksys::phys::KeepAngularVelocity{true});
|
||||
|
||||
sead::Vector3f t = pos - *mTargetPos_d;
|
||||
if (t.length() < *mSpeed_d) {
|
||||
|
|
|
@ -139,7 +139,7 @@ void RagdollController::setTransform(const hkQsTransformf& transform) {
|
|||
if (mExtraRigidBody) {
|
||||
sead::Matrix34f old_transform;
|
||||
mRigidBodies[mRigidBodyIndex]->getTransform(&old_transform);
|
||||
mExtraRigidBody->setTransform(old_transform, true);
|
||||
mExtraRigidBody->setTransform(old_transform);
|
||||
|
||||
if (mGroupHandler) {
|
||||
mExtraRigidBody->setCollisionFilterInfo(
|
||||
|
|
|
@ -476,9 +476,10 @@ void RigidBody::setContactPointInfo(ContactPointInfo* info) {
|
|||
System::instance()->registerContactPointInfo(info);
|
||||
}
|
||||
|
||||
void RigidBody::freeze(bool should_freeze, bool preserve_velocities, bool preserve_max_impulse) {
|
||||
if (hasFlag(Flag::Frozen) == should_freeze) {
|
||||
if (should_freeze) {
|
||||
void RigidBody::freeze(ShouldFreeze should_freeze, PreserveVelocities preserve_velocities,
|
||||
PreserveMaxImpulse preserve_max_impulse) {
|
||||
if (hasFlag(Flag::Frozen) == bool(should_freeze)) {
|
||||
if (bool(should_freeze)) {
|
||||
setLinearVelocity(sead::Vector3f::zero);
|
||||
setAngularVelocity(sead::Vector3f::zero);
|
||||
}
|
||||
|
@ -486,41 +487,43 @@ void RigidBody::freeze(bool should_freeze, bool preserve_velocities, bool preser
|
|||
}
|
||||
|
||||
if (!mMotionAccessor) {
|
||||
mFlags.change(Flag::Frozen, should_freeze);
|
||||
mFlags.change(Flag::Frozen, bool(should_freeze));
|
||||
return;
|
||||
}
|
||||
|
||||
if (should_freeze) {
|
||||
mMotionAccessor->freeze(true, preserve_velocities, preserve_max_impulse);
|
||||
if (bool(should_freeze)) {
|
||||
mMotionAccessor->freeze(true, bool(preserve_velocities), bool(preserve_max_impulse));
|
||||
mFlags.set(Flag::Frozen);
|
||||
} else {
|
||||
mFlags.reset(Flag::Frozen);
|
||||
mMotionAccessor->freeze(false, preserve_velocities, preserve_max_impulse);
|
||||
mMotionAccessor->freeze(false, bool(preserve_velocities), bool(preserve_max_impulse));
|
||||
}
|
||||
}
|
||||
|
||||
void RigidBody::setFixedAndPreserveImpulse(bool fixed, bool mark_linear_vel_as_dirty) {
|
||||
if (hasFlag(Flag::FixedWithImpulsePreserved) != fixed) {
|
||||
mFlags.change(Flag::FixedWithImpulsePreserved, fixed);
|
||||
if (!fixed && mark_linear_vel_as_dirty) {
|
||||
void RigidBody::setFixedAndPreserveImpulse(Fixed fixed,
|
||||
MarkLinearVelAsDirty mark_linear_vel_as_dirty) {
|
||||
if (hasFlag(Flag::FixedWithImpulsePreserved) != bool(fixed)) {
|
||||
mFlags.change(Flag::FixedWithImpulsePreserved, bool(fixed));
|
||||
if (!bool(fixed) && bool(mark_linear_vel_as_dirty)) {
|
||||
setMotionFlag(MotionFlag::DirtyLinearVelocity);
|
||||
}
|
||||
}
|
||||
|
||||
freeze(hasFlag(Flag::FixedWithImpulsePreserved) || hasFlag(Flag::Fixed), true, true);
|
||||
freeze(ShouldFreeze{hasFlag(Flag::FixedWithImpulsePreserved) || hasFlag(Flag::Fixed)},
|
||||
PreserveVelocities{true}, PreserveMaxImpulse{true});
|
||||
}
|
||||
|
||||
void RigidBody::setFixed(bool fixed, bool preserve_velocities) {
|
||||
if (hasFlag(Flag::Fixed) != fixed) {
|
||||
mFlags.change(Flag::Fixed, fixed);
|
||||
if (!fixed) {
|
||||
void RigidBody::setFixed(Fixed fixed, PreserveVelocities preserve_velocities) {
|
||||
if (hasFlag(Flag::Fixed) != bool(fixed)) {
|
||||
mFlags.change(Flag::Fixed, bool(fixed));
|
||||
if (!bool(fixed)) {
|
||||
setMotionFlag(MotionFlag::DirtyLinearVelocity);
|
||||
setMotionFlag(MotionFlag::_40000);
|
||||
}
|
||||
}
|
||||
|
||||
freeze(hasFlag(Flag::FixedWithImpulsePreserved) || hasFlag(Flag::Fixed), preserve_velocities,
|
||||
false);
|
||||
freeze(ShouldFreeze{hasFlag(Flag::FixedWithImpulsePreserved) || hasFlag(Flag::Fixed)},
|
||||
preserve_velocities, PreserveMaxImpulse{false});
|
||||
}
|
||||
|
||||
void RigidBody::resetFrozenState() {
|
||||
|
@ -835,13 +838,14 @@ void RigidBody::setColor(const sead::Color4f& color, const void* a, bool b) {
|
|||
// (which are normally invisible).
|
||||
}
|
||||
|
||||
void RigidBody::setPosition(const sead::Vector3f& position, bool propagate_to_linked_motions) {
|
||||
void RigidBody::setPosition(const sead::Vector3f& position,
|
||||
PropagateToLinkedMotions propagate_to_linked_motions) {
|
||||
if (util::isVectorInvalid(position)) {
|
||||
onInvalidParameter();
|
||||
return;
|
||||
}
|
||||
|
||||
mMotionAccessor->setPosition(position, propagate_to_linked_motions);
|
||||
mMotionAccessor->setPosition(position, bool(propagate_to_linked_motions));
|
||||
}
|
||||
|
||||
void RigidBody::getPosition(sead::Vector3f* position) const {
|
||||
|
@ -888,13 +892,14 @@ sead::Matrix34f RigidBody::getTransform() const {
|
|||
return transform;
|
||||
}
|
||||
|
||||
void RigidBody::setTransform(const sead::Matrix34f& mtx, bool propagate_to_linked_motions) {
|
||||
void RigidBody::setTransform(const sead::Matrix34f& mtx,
|
||||
PropagateToLinkedMotions propagate_to_linked_motions) {
|
||||
if (util::isMatrixInvalid(mtx)) {
|
||||
onInvalidParameter();
|
||||
return;
|
||||
}
|
||||
|
||||
mMotionAccessor->setTransform(mtx, propagate_to_linked_motions);
|
||||
mMotionAccessor->setTransform(mtx, bool(propagate_to_linked_motions));
|
||||
}
|
||||
|
||||
bool RigidBody::isTransformDirty() const {
|
||||
|
@ -1111,14 +1116,15 @@ void RigidBody::changePositionAndRotation(const sead::Matrix34f& transform, floa
|
|||
mMotionAccessor->setAngularVelocity(angular_velocity, epsilon);
|
||||
}
|
||||
|
||||
void RigidBody::changePosition(const sead::Vector3f& target_position, bool keep_angular_velocity,
|
||||
float epsilon) {
|
||||
void RigidBody::changePosition(const sead::Vector3f& target_position,
|
||||
KeepAngularVelocity keep_angular_velocity, float epsilon) {
|
||||
hkVector4f velocity;
|
||||
computeLinearVelocity(&velocity, target_position, keep_angular_velocity);
|
||||
computeLinearVelocity(&velocity, target_position,
|
||||
TakeAngularVelocityIntoAccount{bool(keep_angular_velocity)});
|
||||
|
||||
mMotionAccessor->setLinearVelocity(velocity, epsilon);
|
||||
|
||||
if (!keep_angular_velocity)
|
||||
if (!bool(keep_angular_velocity))
|
||||
mMotionAccessor->setAngularVelocity(sead::Vector3f::zero, epsilon);
|
||||
}
|
||||
|
||||
|
@ -1189,13 +1195,13 @@ void RigidBody::computeLinearVelocity(hkVector4f* velocity, const hkVector4f& ta
|
|||
velocity->mul(inv_delta_time);
|
||||
}
|
||||
|
||||
KSYS_ALWAYS_INLINE void RigidBody::computeLinearVelocity(hkVector4f* velocity,
|
||||
const hkVector4f& target_position,
|
||||
bool take_angular_velocity_into_account,
|
||||
float inv_delta_time) const {
|
||||
KSYS_ALWAYS_INLINE void
|
||||
RigidBody::computeLinearVelocity(hkVector4f* velocity, const hkVector4f& target_position,
|
||||
TakeAngularVelocityIntoAccount take_angular_velocity_into_account,
|
||||
float inv_delta_time) const {
|
||||
auto hk_current_pos = toHkVec4(getPosition());
|
||||
|
||||
if (take_angular_velocity_into_account) {
|
||||
if (bool(take_angular_velocity_into_account)) {
|
||||
const auto center = getCenterOfMassInLocal();
|
||||
if (center.x == 0 && center.y == 0 && center.z == 0) {
|
||||
hkVector4f rel_pos;
|
||||
|
@ -1212,18 +1218,18 @@ KSYS_ALWAYS_INLINE void RigidBody::computeLinearVelocity(hkVector4f* velocity,
|
|||
velocity->mul(inv_delta_time);
|
||||
}
|
||||
|
||||
KSYS_ALWAYS_INLINE void
|
||||
RigidBody::computeLinearVelocity(hkVector4f* velocity, const sead::Vector3f& target_position,
|
||||
bool take_angular_velocity_into_account) const {
|
||||
KSYS_ALWAYS_INLINE void RigidBody::computeLinearVelocity(
|
||||
hkVector4f* velocity, const sead::Vector3f& target_position,
|
||||
TakeAngularVelocityIntoAccount take_angular_velocity_into_account) const {
|
||||
const float inv_delta_time = getInvDeltaTime();
|
||||
const auto hk_target_pos = toHkVec4(target_position);
|
||||
computeLinearVelocity(velocity, hk_target_pos, take_angular_velocity_into_account,
|
||||
inv_delta_time);
|
||||
}
|
||||
|
||||
void RigidBody::computeLinearVelocity(sead::Vector3f* velocity,
|
||||
const sead::Vector3f& target_position,
|
||||
bool take_angular_velocity_into_account) const {
|
||||
void RigidBody::computeLinearVelocity(
|
||||
sead::Vector3f* velocity, const sead::Vector3f& target_position,
|
||||
TakeAngularVelocityIntoAccount take_angular_velocity_into_account) const {
|
||||
hkVector4f result;
|
||||
computeLinearVelocity(&result, target_position, take_angular_velocity_into_account);
|
||||
storeToVec3(velocity, result);
|
||||
|
@ -1744,7 +1750,7 @@ void* RigidBody::m11() {
|
|||
void RigidBody::onMaxPositionExceeded() {
|
||||
// debug logging?
|
||||
[[maybe_unused]] sead::Vector3f position = getPosition();
|
||||
setPosition(sead::Vector3f::zero, true);
|
||||
setPosition(sead::Vector3f::zero, PropagateToLinkedMotions{true});
|
||||
}
|
||||
|
||||
const char* RigidBody::getName() {
|
||||
|
|
|
@ -34,6 +34,15 @@ class RigidBodyMotionSensor;
|
|||
class SystemGroupHandler;
|
||||
class UserTag;
|
||||
|
||||
enum class ShouldFreeze : bool;
|
||||
enum class PreserveVelocities : bool;
|
||||
enum class PreserveMaxImpulse : bool;
|
||||
enum class Fixed : bool;
|
||||
enum class MarkLinearVelAsDirty : bool;
|
||||
enum class PropagateToLinkedMotions : bool;
|
||||
enum class KeepAngularVelocity : bool;
|
||||
enum class TakeAngularVelocityIntoAccount : bool;
|
||||
|
||||
class RigidBase {
|
||||
public:
|
||||
virtual ~RigidBase() = default;
|
||||
|
@ -201,9 +210,10 @@ public:
|
|||
ContactPointInfo* getContactPointInfo() const { return mContactPointInfo; }
|
||||
void setContactPointInfo(ContactPointInfo* info);
|
||||
|
||||
void freeze(bool should_freeze, bool preserve_velocities, bool preserve_max_impulse);
|
||||
void setFixedAndPreserveImpulse(bool fixed, bool mark_linear_vel_as_dirty);
|
||||
void setFixed(bool fixed, bool preserve_velocities);
|
||||
void freeze(ShouldFreeze should_freeze, PreserveVelocities preserve_velocities,
|
||||
PreserveMaxImpulse preserve_max_impulse);
|
||||
void setFixedAndPreserveImpulse(Fixed fixed, MarkLinearVelAsDirty mark_linear_vel_as_dirty);
|
||||
void setFixed(Fixed fixed, PreserveVelocities preserve_velocities);
|
||||
void resetFrozenState();
|
||||
|
||||
// 0x0000007100f8ee50 - FIXME: figure out what type is
|
||||
|
@ -282,7 +292,9 @@ public:
|
|||
|
||||
void setColor(const sead::Color4f& color, const void* a, bool b);
|
||||
|
||||
void setPosition(const sead::Vector3f& position, bool propagate_to_linked_motions);
|
||||
void setPosition(
|
||||
const sead::Vector3f& position,
|
||||
PropagateToLinkedMotions propagate_to_linked_motions = PropagateToLinkedMotions{true});
|
||||
void getPosition(sead::Vector3f* position) const;
|
||||
sead::Vector3f getPosition() const;
|
||||
virtual void onImpulse(RigidBody* body_b, float impulse) const;
|
||||
|
@ -296,7 +308,9 @@ public:
|
|||
|
||||
void getTransform(sead::Matrix34f* mtx) const;
|
||||
sead::Matrix34f getTransform() const;
|
||||
void setTransform(const sead::Matrix34f& mtx, bool propagate_to_linked_motions);
|
||||
void setTransform(
|
||||
const sead::Matrix34f& mtx,
|
||||
PropagateToLinkedMotions propagate_to_linked_motions = PropagateToLinkedMotions{true});
|
||||
bool isTransformDirty() const;
|
||||
|
||||
void updateShape();
|
||||
|
@ -332,7 +346,8 @@ public:
|
|||
/// Modify the body's position by changing the linear velocity.
|
||||
/// This is preferable to setting the position directly (see changePositionAndRotation for an
|
||||
/// explanation).
|
||||
void changePosition(const sead::Vector3f& target_position, bool keep_angular_velocity,
|
||||
void changePosition(const sead::Vector3f& target_position,
|
||||
KeepAngularVelocity keep_angular_velocity,
|
||||
float epsilon = sead::Mathf::epsilon());
|
||||
|
||||
/// Modify the body's rotation by changing the angular velocity.
|
||||
|
@ -361,13 +376,16 @@ public:
|
|||
const hkQuaternionf& rotation, float inv_delta_time) const;
|
||||
/// Compute the linear velocity that would be necessary to instantly reach the target position.
|
||||
void computeLinearVelocity(hkVector4f* velocity, const hkVector4f& target_position,
|
||||
bool take_angular_velocity_into_account, float inv_delta_time) const;
|
||||
TakeAngularVelocityIntoAccount take_angular_velocity_into_account,
|
||||
float inv_delta_time) const;
|
||||
/// Compute the linear velocity that would be necessary to instantly reach the target position.
|
||||
void computeLinearVelocity(hkVector4f* velocity, const sead::Vector3f& target_position,
|
||||
bool take_angular_velocity_into_account) const;
|
||||
void
|
||||
computeLinearVelocity(hkVector4f* velocity, const sead::Vector3f& target_position,
|
||||
TakeAngularVelocityIntoAccount take_angular_velocity_into_account) const;
|
||||
/// Compute the linear velocity that would be necessary to instantly reach the target position.
|
||||
void computeLinearVelocity(sead::Vector3f* velocity, const sead::Vector3f& target_position,
|
||||
bool take_angular_velocity_into_account) const;
|
||||
void
|
||||
computeLinearVelocity(sead::Vector3f* velocity, const sead::Vector3f& target_position,
|
||||
TakeAngularVelocityIntoAccount take_angular_velocity_into_account) const;
|
||||
|
||||
/// Compute the linear and angular velocities that would be necessary to instantly reach the
|
||||
/// target position and rotation.
|
||||
|
|
|
@ -624,7 +624,7 @@ void RigidBodyMotionEntity::copyTransformToAllLinkedBodies() {
|
|||
if (!body->isAddedToWorld() && body->isAddingBodyToWorld()) {
|
||||
sead::Matrix34f transform;
|
||||
mBody->getTransform(&transform);
|
||||
body->setTransform(transform, true);
|
||||
body->setTransform(transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,8 @@ RigidBodySet::~RigidBodySet() {
|
|||
util::PrintDebug("~RigidBodySet");
|
||||
}
|
||||
|
||||
void RigidBodySet::setFixedAndPreserveImpulse(bool fixed, bool mark_linear_vel_as_dirty) {
|
||||
void RigidBodySet::setFixedAndPreserveImpulse(Fixed fixed,
|
||||
MarkLinearVelAsDirty mark_linear_vel_as_dirty) {
|
||||
for (auto& body : mRigidBodies)
|
||||
body.setFixedAndPreserveImpulse(fixed, mark_linear_vel_as_dirty);
|
||||
}
|
||||
|
@ -36,7 +37,7 @@ void RigidBodySet::setEntityMotionFlag200(bool set) {
|
|||
body.setEntityMotionFlag200(set);
|
||||
}
|
||||
|
||||
void RigidBodySet::setFixed(bool fixed, bool preserve_velocities) {
|
||||
void RigidBodySet::setFixed(Fixed fixed, PreserveVelocities preserve_velocities) {
|
||||
for (auto& body : mRigidBodies)
|
||||
body.setFixed(fixed, preserve_velocities);
|
||||
}
|
||||
|
@ -107,7 +108,7 @@ void RigidBodySet::setSystemGroupHandler(SystemGroupHandler* handler, ContactLay
|
|||
|
||||
void RigidBodySet::setTransform(const sead::Matrix34f& mtx) {
|
||||
for (auto& body : mRigidBodies)
|
||||
body.setTransform(mtx, true);
|
||||
body.setTransform(mtx);
|
||||
}
|
||||
|
||||
void RigidBodySet::enableContactLayer(ContactLayer layer) {
|
||||
|
|
|
@ -13,6 +13,10 @@ class RigidBody;
|
|||
class SystemGroupHandler;
|
||||
class UserTag;
|
||||
|
||||
enum class Fixed : bool;
|
||||
enum class MarkLinearVelAsDirty : bool;
|
||||
enum class PreserveVelocities : bool;
|
||||
|
||||
class RigidBodySet : public sead::hostio::Node {
|
||||
public:
|
||||
explicit RigidBodySet(const sead::SafeString& name);
|
||||
|
@ -24,12 +28,12 @@ public:
|
|||
const sead::PtrArray<RigidBody>& getRigidBodies() const { return mRigidBodies; }
|
||||
RigidBody* getRigidBody(int idx) const { return mRigidBodies[idx]; }
|
||||
|
||||
void setFixedAndPreserveImpulse(bool fixed, bool mark_linear_vel_as_dirty);
|
||||
void setFixedAndPreserveImpulse(Fixed fixed, MarkLinearVelAsDirty mark_linear_vel_as_dirty);
|
||||
void resetFrozenState();
|
||||
void setUseSystemTimeFactor(bool use);
|
||||
void clearFlag400000(bool clear);
|
||||
void setEntityMotionFlag200(bool set);
|
||||
void setFixed(bool fixed, bool preserve_velocities);
|
||||
void setFixed(Fixed fixed, PreserveVelocities preserve_velocities);
|
||||
|
||||
void updateMotionTypeRelatedFlags();
|
||||
void triggerScheduledMotionTypeChange();
|
||||
|
|
|
@ -126,7 +126,7 @@ void StaticCompoundRigidBodyGroup::addToWorld() {
|
|||
|
||||
auto lock = body->makeScopedLock();
|
||||
|
||||
body->setTransform(getTransform(), true);
|
||||
body->setTransform(getTransform());
|
||||
|
||||
if (body->getMotionFlags().isOn(RigidBody::MotionFlag::BodyRemovalRequested)) {
|
||||
body->resetMotionFlagDirect(RigidBody::MotionFlag::BodyRemovalRequested);
|
||||
|
@ -204,7 +204,7 @@ void StaticCompoundRigidBodyGroup::applyExtraTransforms() {
|
|||
}
|
||||
|
||||
for (int i = 0, n = mRigidBodies.size(); i < n; ++i) {
|
||||
mRigidBodies[i]->setTransform(getTransform(), true);
|
||||
mRigidBodies[i]->setTransform(getTransform());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue