feat: working rotations

This commit is contained in:
David Markowitz
2026-09-26 00:32:59 -07:00
parent baa9709220
commit b5161790e5
7 changed files with 145 additions and 155 deletions

View File

@@ -1,8 +1,13 @@
#include "ModelComponent.h" #include "ModelComponent.h"
#include <cmath>
#include "Entity.h" #include "Entity.h"
#include "Game.h" #include "Game.h"
#include "Logger.h" #include "Logger.h"
#include "dConfig.h"
#include "dMath.h"
#include "BehaviorStates.h" #include "BehaviorStates.h"
#include "ControlBehaviorMsgs.h" #include "ControlBehaviorMsgs.h"
@@ -19,7 +24,6 @@
ModelComponent::ModelComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) { ModelComponent::ModelComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
m_OriginalPosition = m_Parent->GetDefaultPosition(); m_OriginalPosition = m_Parent->GetDefaultPosition();
m_OriginalRotation = m_Parent->GetDefaultRotation(); m_OriginalRotation = m_Parent->GetDefaultRotation();
LOG("%f %f %f %f", m_OriginalRotation.x, m_OriginalRotation.y, m_OriginalRotation.z, m_OriginalRotation.w);
m_IsPaused = false; m_IsPaused = false;
m_NumListeningInteract = 0; m_NumListeningInteract = 0;
@@ -43,10 +47,7 @@ bool ModelComponent::OnResetModelToDefaults(GameMessages::ResetModelToDefaults&
if (reset.bResetPos) m_Parent->SetPosition(m_OriginalPosition); if (reset.bResetPos) m_Parent->SetPosition(m_OriginalPosition);
if (reset.bResetRot) m_Parent->SetRotation(m_OriginalRotation); if (reset.bResetRot) m_Parent->SetRotation(m_OriginalRotation);
m_Parent->SetVelocity(NiPoint3Constant::ZERO); m_Parent->SetVelocity(NiPoint3Constant::ZERO);
GameMessages::SetAngularVelocity setAngVel; ResetRotationState(m_Parent->GetRotation());
setAngVel.target = m_Parent->GetObjectID();
setAngVel.angVelocity = NiPoint3Constant::ZERO;
setAngVel.Send();
m_Speed = 3.0f; m_Speed = 3.0f;
m_NumListeningInteract = 0; m_NumListeningInteract = 0;
@@ -317,36 +318,60 @@ void ModelComponent::SetVelocity(const NiPoint3& velocity) const {
m_Parent->SetVelocity(velocity); m_Parent->SetVelocity(velocity);
} }
bool ModelComponent::TrySetAngularVelocity(const NiPoint3& angularVelocity) const { bool ModelComponent::TryStartRotation(const int axis, const float direction) {
GameMessages::GetAngularVelocity getAngVel{}; if (axis < 0 || axis > 2 || direction == 0.0f) return false;
getAngVel.target = m_Parent->GetObjectID(); if (m_RotationDirection[axis] != 0.0f) return false;
if (!getAngVel.Send()) {
LOG("Couldn't get angular velocity for %llu", m_Parent->GetObjectID()); // Rebase only when nothing is rotating so simultaneous rotations stay relative to the same base
return false; if (m_RotationDirection == NiPoint3Constant::ZERO) {
ResetRotationState(m_Parent->GetRotation());
m_SendAngularVelocity = Game::config->GetValue("model_rotation_send_angular_velocity") != "0";
} }
m_RotationDegrees[axis] = std::fmod(m_RotationDegrees[axis], 360.0f);
m_RotationActionStart[axis] = m_RotationDegrees[axis];
m_RotationDirection[axis] = direction > 0.0f ? 1.0f : -1.0f;
SyncAngularVelocity();
return true;
}
void ModelComponent::SetRotationProgress(const int axis, const float degrees) {
if (axis < 0 || axis > 2) return;
m_RotationDegrees[axis] = m_RotationActionStart[axis] + degrees;
// Whole turns wrap to exactly 0 so e.g. 720 degrees yields exactly the base rotation
const NiPoint3 radians(
Math::DegToRad(std::fmod(m_RotationDegrees.x, 360.0f)),
Math::DegToRad(std::fmod(m_RotationDegrees.y, 360.0f)),
Math::DegToRad(std::fmod(m_RotationDegrees.z, 360.0f))
);
m_Parent->SetRotation(QuatUtils::FromEuler(radians) * m_RotationBase);
}
void ModelComponent::StopRotation(const int axis) {
if (axis < 0 || axis > 2) return;
m_RotationDirection[axis] = 0.0f;
SyncAngularVelocity();
}
void ModelComponent::SetSpeed(const float newSpeed) {
m_Speed = newSpeed;
if (m_RotationDirection != NiPoint3Constant::ZERO) SyncAngularVelocity();
}
void ModelComponent::SyncAngularVelocity() const {
GameMessages::SetAngularVelocity setAngVel{}; GameMessages::SetAngularVelocity setAngVel{};
setAngVel.target = m_Parent->GetObjectID(); setAngVel.target = m_Parent->GetObjectID();
if (angularVelocity != NiPoint3Constant::ZERO) { setAngVel.angVelocity = m_SendAngularVelocity ? m_RotationDirection * Math::DegToRad(GetAngularSpeed()) : NiPoint3Constant::ZERO;
setAngVel.angVelocity = getAngVel.angVelocity;
const auto [x, y, z] = angularVelocity * m_Speed;
if (x != 0.0f) {
if (getAngVel.angVelocity.x != 0.0f) return false;
setAngVel.angVelocity.x = x;
} else if (y != 0.0f) {
if (getAngVel.angVelocity.y != 0.0f) return false;
setAngVel.angVelocity.y = y;
} else if (z != 0.0f) {
if (getAngVel.angVelocity.z != 0.0f) return false;
setAngVel.angVelocity.z = z;
}
} else {
setAngVel.angVelocity = angularVelocity;
}
LOG("Setting angular velocity to %f %f %f", setAngVel.angVelocity.x, setAngVel.angVelocity.y, setAngVel.angVelocity.z);
setAngVel.Send(); setAngVel.Send();
}
return true; void ModelComponent::ResetRotationState(const NiQuaternion& newBase) {
m_RotationBase = newBase;
m_RotationDegrees = NiPoint3Constant::ZERO;
m_RotationActionStart = NiPoint3Constant::ZERO;
m_RotationDirection = NiPoint3Constant::ZERO;
SyncAngularVelocity();
} }
void ModelComponent::OnChatMessageReceived(const std::string& sMessage) { void ModelComponent::OnChatMessageReceived(const std::string& sMessage) {

View File

@@ -147,17 +147,25 @@ public:
// Force sets the velocity to a value. // Force sets the velocity to a value.
void SetVelocity(const NiPoint3& velocity) const; void SetVelocity(const NiPoint3& velocity) const;
// Attempts to set the angular velocity of the model. // Attempts to claim a world axis (0 = x, 1 = y, 2 = z) for rotation in direction (+1 or -1).
// If the axis currently has a velocity of zero, returns true. // Returns false if the axis is already controlled by a behavior.
// If the axis is currently controlled by a behavior, returns false. bool TryStartRotation(const int axis, const float direction);
bool TrySetAngularVelocity(const NiPoint3& angularVelocity) const;
// Sets how many signed degrees the active rotation on axis has progressed and updates the entity.
void SetRotationProgress(const int axis, const float degrees);
// Releases the axis so another behavior can rotate it.
void StopRotation(const int axis);
// Degrees per second for rotation actions at the current speed.
float GetAngularSpeed() const noexcept { return BASE_ANGULAR_SPEED * m_Speed; }
void OnChatMessageReceived(const std::string& sMessage); void OnChatMessageReceived(const std::string& sMessage);
void OnHit(); void OnHit();
// Sets the speed of the model // Sets the speed of the model
void SetSpeed(const float newSpeed) { m_Speed = newSpeed; } void SetSpeed(const float newSpeed);
// Whether or not to restart at the end of the frame // Whether or not to restart at the end of the frame
void RestartAtEndOfFrame() { m_RestartAtEndOfFrame = true; } void RestartAtEndOfFrame() { m_RestartAtEndOfFrame = true; }
@@ -172,6 +180,14 @@ public:
float GetSpeed() const noexcept { return m_Speed; } float GetSpeed() const noexcept { return m_Speed; }
private: private:
// Degrees per second per unit of m_Speed
static constexpr float BASE_ANGULAR_SPEED = 15.0f;
// Sends the client-side angular velocity for the currently active rotation axes.
void SyncAngularVelocity() const;
// Clears all rotation state and makes rotation relative to newBase.
void ResetRotationState(const NiQuaternion& newBase);
// Loads a behavior from the database. // Loads a behavior from the database.
void LoadBehavior(const LWOOBJID behaviorID, const size_t index, const bool isIndexed); void LoadBehavior(const LWOOBJID behaviorID, const size_t index, const bool isIndexed);
@@ -220,4 +236,19 @@ private:
// Whether or not to restart at the end of the frame. // Whether or not to restart at the end of the frame.
bool m_RestartAtEndOfFrame{ false }; bool m_RestartAtEndOfFrame{ false };
// The rotation that m_RotationDegrees is applied on top of
NiQuaternion m_RotationBase = QuatUtils::IDENTITY;
// Accumulated signed degrees per world axis since m_RotationBase was set
NiPoint3 m_RotationDegrees{};
// m_RotationDegrees at the moment the current rotation on each axis started
NiPoint3 m_RotationActionStart{};
// Per axis -1, 0 or 1. Non-zero means a behavior currently owns rotation on that axis.
NiPoint3 m_RotationDirection{};
// Whether the client is sent an angular velocity to extrapolate rotation between updates
bool m_SendAngularVelocity{ true };
}; };

View File

@@ -40,20 +40,11 @@ SimplePhysicsComponent::~SimplePhysicsComponent() {
} }
void SimplePhysicsComponent::Update(const float deltaTime) { void SimplePhysicsComponent::Update(const float deltaTime) {
if (m_Velocity != NiPoint3Constant::ZERO) { // Rotation is driven by ModelComponent; angular velocity is only relayed to clients.
m_Position += m_Velocity * deltaTime; if (m_Velocity == NiPoint3Constant::ZERO) return;
m_DirtyPosition = true; m_Position += m_Velocity * deltaTime;
Game::entityManager->SerializeEntity(m_Parent); m_DirtyPosition = true;
} Game::entityManager->SerializeEntity(m_Parent);
if (m_AngularVelocity != NiPoint3Constant::ZERO) {
m_Rotation.Normalize();
const auto vel = NiQuaternion::FromEulerAngles(m_AngularVelocity * deltaTime);
m_Rotation *= vel;
const auto euler = m_Rotation.GetEulerAngles();
m_DirtyPosition = true;
Game::entityManager->SerializeEntity(m_Parent);
}
} }
void SimplePhysicsComponent::Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) { void SimplePhysicsComponent::Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) {
@@ -102,17 +93,15 @@ bool SimplePhysicsComponent::OnGetObjectReportInfo(GameMessages::GetObjectReport
return true; return true;
} }
bool SimplePhysicsComponent::OnSetAngularVelocity(GameMessages::GameMsg& msg) { bool SimplePhysicsComponent::OnSetAngularVelocity(GameMessages::SetAngularVelocity& setAngVel) {
auto& setAngVel = static_cast<GameMessages::SetAngularVelocity&>(msg);
m_DirtyVelocity |= setAngVel.bForceFlagDirty || (m_AngularVelocity != setAngVel.angVelocity); m_DirtyVelocity |= setAngVel.bForceFlagDirty || (m_AngularVelocity != setAngVel.angVelocity);
m_AngularVelocity = setAngVel.angVelocity; m_AngularVelocity = setAngVel.angVelocity;
LOG("Velocity is now %f %f %f", m_AngularVelocity.x, m_AngularVelocity.y, m_AngularVelocity.z); LOG_DEBUG("Angular velocity is now %f %f %f", m_AngularVelocity.x, m_AngularVelocity.y, m_AngularVelocity.z);
Game::entityManager->SerializeEntity(m_Parent); Game::entityManager->SerializeEntity(m_Parent);
return true; return true;
} }
bool SimplePhysicsComponent::OnGetAngularVelocity(GameMessages::GameMsg& msg) { bool SimplePhysicsComponent::OnGetAngularVelocity(GameMessages::GetAngularVelocity& getAngVel) {
auto& getAngVel = static_cast<GameMessages::GetAngularVelocity&>(msg);
getAngVel.angVelocity = m_AngularVelocity; getAngVel.angVelocity = m_AngularVelocity;
return true; return true;
} }

View File

@@ -22,6 +22,11 @@ enum class eClimbableType : int32_t {
CLIMBABLE_TYPE_WALL_STICK CLIMBABLE_TYPE_WALL_STICK
}; };
namespace GameMessages {
struct SetAngularVelocity;
struct GetAngularVelocity;
}
/** /**
* Component that serializes locations of entities to the client * Component that serializes locations of entities to the client
@@ -61,8 +66,8 @@ public:
*/ */
void SetAngularVelocity(const NiPoint3& value) { m_AngularVelocity = value; m_DirtyVelocity = true; } void SetAngularVelocity(const NiPoint3& value) { m_AngularVelocity = value; m_DirtyVelocity = true; }
bool OnSetAngularVelocity(GameMessages::GameMsg& msg); bool OnSetAngularVelocity(GameMessages::SetAngularVelocity& setAngVel);
bool OnGetAngularVelocity(GameMessages::GameMsg& msg); bool OnGetAngularVelocity(GameMessages::GetAngularVelocity& getAngVel);
/** /**
* Returns the physics motion state * Returns the physics motion state

View File

@@ -9,7 +9,6 @@
#include "PropertyManagementComponent.h" #include "PropertyManagementComponent.h"
#include "PlayerManager.h" #include "PlayerManager.h"
#include "SimplePhysicsComponent.h" #include "SimplePhysicsComponent.h"
#include "dMath.h"
#include "dChatFilter.h" #include "dChatFilter.h"
@@ -108,6 +107,8 @@ void Strip::HandleMsg(GameMessages::ResetModelToDefaults& msg) {
m_NextActionIndex = 0; m_NextActionIndex = 0;
m_InActionTranslation = NiPoint3Constant::ZERO; m_InActionTranslation = NiPoint3Constant::ZERO;
m_PreviousFramePosition = NiPoint3Constant::ZERO; m_PreviousFramePosition = NiPoint3Constant::ZERO;
m_InActionRotation = NiPoint3Constant::ZERO;
m_RotationProgress = 0.0f;
} }
void Strip::OnChatMessageReceived(const std::string& sMessage) { void Strip::OnChatMessageReceived(const std::string& sMessage) {
@@ -173,7 +174,6 @@ void Strip::ProcNormalAction(float deltaTime, ModelComponent& modelComponent, Up
// TODO replace with switch case and nextActionType with enum // TODO replace with switch case and nextActionType with enum
/* BEGIN Move */ /* BEGIN Move */
if (nextActionType == "MoveRight" || nextActionType == "MoveLeft") { if (nextActionType == "MoveRight" || nextActionType == "MoveLeft") {
m_IsRotating = false;
// X axis // X axis
bool isMoveLeft = nextActionType == "MoveLeft"; bool isMoveLeft = nextActionType == "MoveLeft";
int negative = isMoveLeft ? -1 : 1; int negative = isMoveLeft ? -1 : 1;
@@ -183,7 +183,6 @@ void Strip::ProcNormalAction(float deltaTime, ModelComponent& modelComponent, Up
m_InActionTranslation.x = isMoveLeft ? -number : number; m_InActionTranslation.x = isMoveLeft ? -number : number;
} }
} else if (nextActionType == "FlyUp" || nextActionType == "FlyDown") { } else if (nextActionType == "FlyUp" || nextActionType == "FlyDown") {
m_IsRotating = false;
// Y axis // Y axis
bool isFlyDown = nextActionType == "FlyDown"; bool isFlyDown = nextActionType == "FlyDown";
int negative = isFlyDown ? -1 : 1; int negative = isFlyDown ? -1 : 1;
@@ -194,7 +193,6 @@ void Strip::ProcNormalAction(float deltaTime, ModelComponent& modelComponent, Up
} }
} else if (nextActionType == "MoveForward" || nextActionType == "MoveBackward") { } else if (nextActionType == "MoveForward" || nextActionType == "MoveBackward") {
m_IsRotating = false;
// Z axis // Z axis
bool isMoveBackward = nextActionType == "MoveBackward"; bool isMoveBackward = nextActionType == "MoveBackward";
int negative = isMoveBackward ? -1 : 1; int negative = isMoveBackward ? -1 : 1;
@@ -208,40 +206,25 @@ void Strip::ProcNormalAction(float deltaTime, ModelComponent& modelComponent, Up
/* BEGIN Rotate */ /* BEGIN Rotate */
else if (nextActionType == "Spin" || nextActionType == "SpinNegative") { else if (nextActionType == "Spin" || nextActionType == "SpinNegative") {
const float radians = Math::DegToRad(number); // Y axis
bool isSpinNegative = nextActionType == "SpinNegative"; const float direction = nextActionType == "SpinNegative" ? -1.0f : 1.0f;
float negative = isSpinNegative ? -0.261799f : 0.261799f; if (number != 0.0 && modelComponent.TryStartRotation(1, direction)) {
m_InActionRotation.y = direction * number;
// Default angular velocity is 3 units per second. m_RotationProgress = 0.0f;
if (modelComponent.TrySetAngularVelocity(NiPoint3Constant::UNIT_Y * negative)) {
m_IsRotating = true;
m_InActionTranslation.y = isSpinNegative ? -number : number;
m_PreviousFrameRotation = entity.GetRotation();
// d/vi = t
// radians/velocity = time
// only care about the time, direction is irrelevant here
} }
} else if (nextActionType == "Tilt" || nextActionType == "TiltNegative") { } else if (nextActionType == "Tilt" || nextActionType == "TiltNegative") {
const float radians = Math::DegToRad(number); // X axis
bool isRotateLeft = nextActionType == "TiltNegative"; const float direction = nextActionType == "TiltNegative" ? -1.0f : 1.0f;
float negative = isRotateLeft ? -0.261799f : 0.261799f; if (number != 0.0 && modelComponent.TryStartRotation(0, direction)) {
m_InActionRotation.x = direction * number;
// Default angular velocity is 3 units per second. m_RotationProgress = 0.0f;
if (modelComponent.TrySetAngularVelocity(NiPoint3Constant::UNIT_X * negative)) {
m_IsRotating = true;
m_InActionTranslation.x = isRotateLeft ? -number : number;
m_PreviousFrameRotation = entity.GetRotation();
} }
} else if (nextActionType == "Roll" || nextActionType == "RollNegative") { } else if (nextActionType == "Roll" || nextActionType == "RollNegative") {
const float radians = Math::DegToRad(number); // Z axis
bool isRotateDown = nextActionType == "RollNegative"; const float direction = nextActionType == "RollNegative" ? -1.0f : 1.0f;
float negative = isRotateDown ? -0.261799f : 0.261799f; if (number != 0.0 && modelComponent.TryStartRotation(2, direction)) {
m_InActionRotation.z = direction * number;
// Default angular velocity is 3 units per second. m_RotationProgress = 0.0f;
if (modelComponent.TrySetAngularVelocity(NiPoint3Constant::UNIT_Z * negative)) {
m_IsRotating = true;
m_InActionTranslation.z = isRotateDown ? -number : number;
m_PreviousFrameRotation = entity.GetRotation();
} }
} }
/* END Rotate */ /* END Rotate */
@@ -346,8 +329,6 @@ void Strip::RemoveStates(ModelComponent& modelComponent) const {
} }
bool Strip::CheckMovement(float deltaTime, ModelComponent& modelComponent) { bool Strip::CheckMovement(float deltaTime, ModelComponent& modelComponent) {
if (m_IsRotating) return true;
auto& entity = *modelComponent.GetParent(); auto& entity = *modelComponent.GetParent();
const auto& currentPos = entity.GetPosition(); const auto& currentPos = entity.GetPosition();
const auto diff = currentPos - m_PreviousFramePosition; const auto diff = currentPos - m_PreviousFramePosition;
@@ -393,65 +374,24 @@ bool Strip::CheckMovement(float deltaTime, ModelComponent& modelComponent) {
} }
bool Strip::CheckRotation(float deltaTime, ModelComponent& modelComponent) { bool Strip::CheckRotation(float deltaTime, ModelComponent& modelComponent) {
if (!m_IsRotating) return true; for (int axis = 0; axis < 3; axis++) {
GameMessages::GetAngularVelocity getAngVel{}; const float target = m_InActionRotation[axis];
getAngVel.target = modelComponent.GetParent()->GetObjectID(); if (target == 0.0f) continue;
getAngVel.Send();
const auto curRotation = modelComponent.GetParent()->GetRotation(); // Snapping to the target keeps the final angle exact regardless of speed or frame time
const auto diff = m_PreviousFrameRotation.Diff(curRotation).GetEulerAngles(); const float step = modelComponent.GetAngularSpeed() * deltaTime;
LOG("Diff: x=%f, y=%f, z=%f", std::abs(Math::RadToDeg(diff.x)), std::abs(Math::RadToDeg(diff.y)), std::abs(Math::RadToDeg(diff.z))); if (std::abs(target - m_RotationProgress) <= step) m_RotationProgress = target;
LOG("Velocity: x=%f, y=%f, z=%f", Math::RadToDeg(getAngVel.angVelocity.x) * deltaTime, Math::RadToDeg(getAngVel.angVelocity.y) * deltaTime, Math::RadToDeg(getAngVel.angVelocity.z) * deltaTime); else m_RotationProgress += std::copysign(step, target);
m_PreviousFrameRotation = curRotation;
auto angVel = diff; modelComponent.SetRotationProgress(axis, m_RotationProgress);
angVel.x = std::abs(Math::RadToDeg(angVel.x)); if (m_RotationProgress != target) return false;
angVel.y = std::abs(Math::RadToDeg(angVel.y));
angVel.z = std::abs(Math::RadToDeg(angVel.z)); modelComponent.StopRotation(axis);
const auto [rotateX, rotateY, rotateZ] = m_InActionTranslation; m_InActionRotation = NiPoint3Constant::ZERO;
bool rotateFinished = true; m_RotationProgress = 0.0f;
NiPoint3 finalRotationAdjustment = NiPoint3Constant::ZERO;
if (rotateX != 0.0f) {
m_InActionTranslation.x -= angVel.x;
rotateFinished = std::signbit(m_InActionTranslation.x) != std::signbit(rotateX);
finalRotationAdjustment.x = Math::DegToRad(m_InActionTranslation.x);
} else if (rotateY != 0.0f) {
m_InActionTranslation.y -= angVel.y;
rotateFinished = std::signbit(m_InActionTranslation.y) != std::signbit(rotateY);
finalRotationAdjustment.y = Math::DegToRad(m_InActionTranslation.y);
} else if (rotateZ != 0.0f) {
m_InActionTranslation.z -= angVel.z;
rotateFinished = std::signbit(m_InActionTranslation.z) != std::signbit(rotateZ);
finalRotationAdjustment.z = Math::DegToRad(m_InActionTranslation.z);
} }
if (rotateFinished && m_InActionTranslation != NiPoint3Constant::ZERO) { return true;
LOG("Rotation finished, zeroing angVel");
angVel.x = Math::DegToRad(angVel.x);
angVel.y = Math::DegToRad(angVel.y);
angVel.z = Math::DegToRad(angVel.z);
if (rotateX != 0.0f) getAngVel.angVelocity.x = 0.0f;
else if (rotateY != 0.0f) getAngVel.angVelocity.y = 0.0f;
else if (rotateZ != 0.0f) getAngVel.angVelocity.z = 0.0f;
GameMessages::SetAngularVelocity setAngVel{};
setAngVel.target = modelComponent.GetParent()->GetObjectID();
setAngVel.angVelocity = getAngVel.angVelocity;
setAngVel.Send();
// Do the final adjustment so we will have rotated exactly the requested units
auto currentRot = modelComponent.GetParent()->GetRotation();
NiQuaternion finalAdjustment = NiQuaternion::FromEulerAngles(finalRotationAdjustment);
currentRot *= finalAdjustment;
currentRot.Normalize();
modelComponent.GetParent()->SetRotation(currentRot);
m_InActionTranslation = NiPoint3Constant::ZERO;
m_IsRotating = false;
}
LOG("angVel: x=%f, y=%f, z=%f", m_InActionTranslation.x, m_InActionTranslation.y, m_InActionTranslation.z);
return rotateFinished;
} }
void Strip::Update(float deltaTime, ModelComponent& modelComponent, UpdateResult& updateResult) { void Strip::Update(float deltaTime, ModelComponent& modelComponent, UpdateResult& updateResult) {

View File

@@ -52,9 +52,6 @@ private:
// Indicates this Strip is waiting for an action to be taken upon it to progress to its actions // Indicates this Strip is waiting for an action to be taken upon it to progress to its actions
bool m_WaitingForAction{ false }; bool m_WaitingForAction{ false };
// True if this strip is currently rotating
bool m_IsRotating{ false };
// The amount of time this strip is paused for. Any interactions with this strip should be bounced if this is greater than 0. // The amount of time this strip is paused for. Any interactions with this strip should be bounced if this is greater than 0.
// Actions that do not use time do not use this (ex. positions). // Actions that do not use time do not use this (ex. positions).
float m_PausedTime{ 0.0f }; float m_PausedTime{ 0.0f };
@@ -75,11 +72,11 @@ private:
// The position of the parent model on the previous frame // The position of the parent model on the previous frame
NiPoint3 m_PreviousFramePosition{}; NiPoint3 m_PreviousFramePosition{};
NiPoint3 m_RotationRemaining{}; // The signed target degrees of the current rotation action. Only 1 axis is active at once for any given strip.
NiPoint3 m_InActionRotation{};
NiQuaternion m_PreviousFrameRotation{}; // The signed degrees the current rotation action has progressed so far
float m_RotationProgress{ 0.0f };
NiPoint3 m_SavedVelocity{};
}; };
#endif //!__STRIP__H__ #endif //!__STRIP__H__

View File

@@ -105,3 +105,6 @@ hardcore_coin_keep=
# save pre-split lxfmls to disk for debugging # save pre-split lxfmls to disk for debugging
save_lxfmls=0 save_lxfmls=0
# Send models' angular velocity to clients so they extrapolate rotation between updates (1) or only send rotation (0)
model_rotation_send_angular_velocity=1