mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-07 07:02:46 +02:00
Fix look at update and allow to release control
This commit is contained in:
parent
20282571ee
commit
ab6631fae3
3 changed files with 22 additions and 2 deletions
|
@ -6807,7 +6807,7 @@ void MyAvatar::updateHeadLookAt(float deltaTime) {
|
|||
|
||||
if (_scriptControlsHeadLookAt) {
|
||||
_scriptHeadControlTimer += deltaTime;
|
||||
if (_scriptHeadControlTimer > MAX_LOOK_AT_TIME_SCRIPT_CONTROL) {
|
||||
if (_scriptHeadControlTimer >= MAX_LOOK_AT_TIME_SCRIPT_CONTROL) {
|
||||
_scriptHeadControlTimer = 0.0f;
|
||||
_scriptControlsHeadLookAt = false;
|
||||
_lookAtCameraTarget = _lookAtScriptTarget;
|
||||
|
@ -6839,6 +6839,14 @@ void MyAvatar::setEyesLookAt(const glm::vec3& lookAtTarget) {
|
|||
_scriptControlsEyesLookAt = true;
|
||||
}
|
||||
|
||||
void MyAvatar::releaseHeadLookAtControl() {
|
||||
_scriptHeadControlTimer = MAX_LOOK_AT_TIME_SCRIPT_CONTROL;
|
||||
}
|
||||
|
||||
void MyAvatar::releaseEyesLookAtControl() {
|
||||
_scriptEyesControlTimer = MAX_LOOK_AT_TIME_SCRIPT_CONTROL;
|
||||
}
|
||||
|
||||
glm::vec3 MyAvatar::getLookAtPivotPoint() {
|
||||
glm::vec3 avatarUp = getWorldOrientation() * Vectors::UP;
|
||||
glm::vec3 yAxisEyePosition = getWorldPosition() + avatarUp * glm::dot(avatarUp, _skeletonModel->getDefaultEyeModelPosition());
|
||||
|
|
|
@ -1769,6 +1769,12 @@ public:
|
|||
*/
|
||||
Q_INVOKABLE glm::vec3 getHeadLookAt() { return _lookAtCameraTarget; }
|
||||
|
||||
/**jsdoc
|
||||
* When this function is called the engine regains control of the head immediately.
|
||||
* @function MyAvatar.releaseHeadLookAtControl
|
||||
*/
|
||||
Q_INVOKABLE void releaseHeadLookAtControl();
|
||||
|
||||
/**jsdoc
|
||||
* Force the avatar's eyes to look to the specified location.
|
||||
* Once this method is called, API calls will have full control of the eyes for a limited time.
|
||||
|
@ -1785,6 +1791,12 @@ public:
|
|||
*/
|
||||
Q_INVOKABLE glm::vec3 getEyesLookAt() { return _eyesLookAtTarget.get(); }
|
||||
|
||||
/**jsdoc
|
||||
* When this function is called the engine regains control of the eyes immediately.
|
||||
* @function MyAvatar.releaseEyesLookAtControl
|
||||
*/
|
||||
Q_INVOKABLE void releaseEyesLookAtControl();
|
||||
|
||||
/**jsdoc
|
||||
* Aims the pointing directional blending towards the provided target point.
|
||||
* The "point" reaction should be triggered before using this method.
|
||||
|
|
|
@ -358,7 +358,6 @@ float Head::getFinalRoll() const {
|
|||
|
||||
void Head::setLookAtPosition(const glm::vec3& lookAtPosition) {
|
||||
if (_isEyeLookAtUpdated && _requestLookAtPosition != lookAtPosition) {
|
||||
_lookAtPositionChanged = usecTimestampNow();
|
||||
glm::vec3 oldAvatarLookAtVector = _requestLookAtPosition - _owningAvatar->getWorldPosition();
|
||||
glm::vec3 newAvatarLookAtVector = lookAtPosition - _owningAvatar->getWorldPosition();
|
||||
const float MIN_BLINK_ANGLE = 0.35f; // 20 degrees
|
||||
|
@ -369,6 +368,7 @@ void Head::setLookAtPosition(const glm::vec3& lookAtPosition) {
|
|||
_lookAtPosition = lookAtPosition;
|
||||
}
|
||||
}
|
||||
_lookAtPositionChanged = usecTimestampNow();
|
||||
_requestLookAtPosition = lookAtPosition;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue