mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 23:09:52 +02:00
Get state using CharacterController
This commit is contained in:
parent
93a1adc736
commit
02837be13f
2 changed files with 13 additions and 17 deletions
|
@ -6846,17 +6846,14 @@ glm::vec3 MyAvatar::getCameraEyesPosition(float deltaTime) {
|
||||||
frontOffset = frontOffset < 0.0f ? 0.0f : mixAlpha * frontOffset;
|
frontOffset = frontOffset < 0.0f ? 0.0f : mixAlpha * frontOffset;
|
||||||
glm::vec3 cameraOffset = upOffset * Vectors::UP + frontOffset * Vectors::FRONT;
|
glm::vec3 cameraOffset = upOffset * Vectors::UP + frontOffset * Vectors::FRONT;
|
||||||
const float TAU = 0.1f;
|
const float TAU = 0.1f;
|
||||||
_cameraEyesOffset = _cameraEyesOffset + (cameraOffset - _cameraEyesOffset) * TAU * timeScale;
|
_cameraEyesOffset = _cameraEyesOffset + (cameraOffset - _cameraEyesOffset) * min(1.0f, TAU * timeScale);
|
||||||
glm::vec3 estimatedCameraPosition = defaultEyesPosition + getWorldOrientation() * _cameraEyesOffset;
|
glm::vec3 estimatedCameraPosition = defaultEyesPosition + getWorldOrientation() * _cameraEyesOffset;
|
||||||
return estimatedCameraPosition;
|
return estimatedCameraPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MyAvatar::isJumping() {
|
bool MyAvatar::isJumping() {
|
||||||
if (_skeletonModel->isLoaded()) {
|
return (_characterController.getState() == CharacterController::State::InAir ||
|
||||||
return (_skeletonModel->getRig().getState() == Rig::RigRole::InAir ||
|
_characterController.getState() == CharacterController::State::Takeoff) && !isFlying();
|
||||||
_skeletonModel->getRig().getState() == Rig::RigRole::Takeoff) && !isFlying();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MyAvatar::setPointAt(const glm::vec3& pointAtTarget) {
|
bool MyAvatar::setPointAt(const glm::vec3& pointAtTarget) {
|
||||||
|
|
|
@ -115,16 +115,6 @@ public:
|
||||||
Seated
|
Seated
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class RigRole {
|
|
||||||
Idle = 0,
|
|
||||||
Turn,
|
|
||||||
Move,
|
|
||||||
Hover,
|
|
||||||
Takeoff,
|
|
||||||
InAir,
|
|
||||||
Seated
|
|
||||||
};
|
|
||||||
|
|
||||||
Rig();
|
Rig();
|
||||||
virtual ~Rig();
|
virtual ~Rig();
|
||||||
|
|
||||||
|
@ -267,7 +257,6 @@ public:
|
||||||
bool getFlowActive() const;
|
bool getFlowActive() const;
|
||||||
bool getNetworkGraphActive() const;
|
bool getNetworkGraphActive() const;
|
||||||
void setDirectionalBlending(const QString& targetName, const glm::vec3& blendingTarget, const QString& alphaName, float alpha);
|
void setDirectionalBlending(const QString& targetName, const glm::vec3& blendingTarget, const QString& alphaName, float alpha);
|
||||||
const RigRole getState() const { return _state; }
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void onLoadComplete();
|
void onLoadComplete();
|
||||||
|
@ -350,6 +339,16 @@ protected:
|
||||||
AnimVariantMap _animVars;
|
AnimVariantMap _animVars;
|
||||||
AnimVariantMap _networkVars;
|
AnimVariantMap _networkVars;
|
||||||
|
|
||||||
|
enum class RigRole {
|
||||||
|
Idle = 0,
|
||||||
|
Turn,
|
||||||
|
Move,
|
||||||
|
Hover,
|
||||||
|
Takeoff,
|
||||||
|
InAir,
|
||||||
|
Seated
|
||||||
|
};
|
||||||
|
|
||||||
RigRole _state { RigRole::Idle };
|
RigRole _state { RigRole::Idle };
|
||||||
RigRole _desiredState { RigRole::Idle };
|
RigRole _desiredState { RigRole::Idle };
|
||||||
float _desiredStateAge { 0.0f };
|
float _desiredStateAge { 0.0f };
|
||||||
|
|
Loading…
Reference in a new issue