15 #ifndef hifi_MyAvatar_h
16 #define hifi_MyAvatar_h
21 #include <glm/glm.hpp>
25 #include <AvatarConstants.h>
26 #include <avatars-renderer/Avatar.h>
27 #include <avatars-renderer/ScriptAvatar.h>
28 #include <controllers/Pose.h>
29 #include <controllers/Actions.h>
30 #include <EntityItem.h>
31 #include <HelperScriptEngine.h>
32 #include <ThreadSafeValueCache.h>
34 #include <SettingHandle.h>
36 #include <shared/Camera.h>
37 #include <ScriptValue.h>
39 #include "AtRestDetector.h"
40 #include "MyCharacterController.h"
41 #include "RingBufferHistory.h"
43 class AvatarActionHold;
46 class DetailedMotionState;
48 using ScriptEnginePointer = std::shared_ptr<ScriptEngine>;
50 enum LocomotionRelativeMovementMode {
51 MOVEMENT_HMD_RELATIVE = 0,
52 MOVEMENT_HAND_RELATIVE,
53 MOVEMENT_HAND_RELATIVE_LEVELED
56 enum eyeContactTarget {
62 enum AudioListenerMode {
68 Q_DECLARE_METATYPE(AudioListenerMode);
70 class MyAvatar :
public Avatar {
72 friend class AnimStats;
326 Q_PROPERTY(QVector3D qmlPosition READ getQmlPosition)
327 QVector3D getQmlPosition() {
auto p = getWorldPosition();
return QVector3D(p.x, p.y, p.z); }
329 Q_PROPERTY(glm::vec3 feetPosition READ getWorldFeetPosition WRITE goToFeetLocation)
330 Q_PROPERTY(
bool shouldRenderLocally READ getShouldRenderLocally WRITE setShouldRenderLocally)
331 Q_PROPERTY(glm::vec3 motorVelocity READ getScriptedMotorVelocity WRITE setScriptedMotorVelocity)
332 Q_PROPERTY(
float motorTimescale READ getScriptedMotorTimescale WRITE setScriptedMotorTimescale)
333 Q_PROPERTY(QString motorReferenceFrame READ getScriptedMotorFrame WRITE setScriptedMotorFrame)
334 Q_PROPERTY(QString motorMode READ getScriptedMotorMode WRITE setScriptedMotorMode)
335 Q_PROPERTY(QString collisionSoundURL READ getCollisionSoundURL WRITE setCollisionSoundURL)
336 Q_PROPERTY(AudioListenerMode audioListenerMode READ getAudioListenerMode WRITE setAudioListenerMode)
337 Q_PROPERTY(AudioListenerMode audioListenerModeHead READ getAudioListenerModeHead)
338 Q_PROPERTY(AudioListenerMode audioListenerModeCamera READ getAudioListenerModeCamera)
339 Q_PROPERTY(AudioListenerMode audioListenerModeCustom READ getAudioListenerModeCustom)
340 Q_PROPERTY(glm::vec3 customListenPosition READ getCustomListenPosition WRITE setCustomListenPosition)
341 Q_PROPERTY(glm::quat customListenOrientation READ getCustomListenOrientation WRITE setCustomListenOrientation)
342 Q_PROPERTY(
float rotationRecenterFilterLength READ getRotationRecenterFilterLength WRITE setRotationRecenterFilterLength)
343 Q_PROPERTY(
float rotationThreshold READ getRotationThreshold WRITE setRotationThreshold)
344 Q_PROPERTY(
bool enableStepResetRotation READ getEnableStepResetRotation WRITE setEnableStepResetRotation)
345 Q_PROPERTY(
bool enableDrawAverageFacing READ getEnableDrawAverageFacing WRITE setEnableDrawAverageFacing)
348 Q_PROPERTY(glm::vec3 leftHandPosition READ getLeftHandPosition)
349 Q_PROPERTY(glm::vec3 rightHandPosition READ getRightHandPosition)
350 Q_PROPERTY(glm::vec3 leftHandTipPosition READ getLeftHandTipPosition)
351 Q_PROPERTY(glm::vec3 rightHandTipPosition READ getRightHandTipPosition)
353 Q_PROPERTY(controller::Pose leftHandPose READ getLeftHandPose)
354 Q_PROPERTY(controller::Pose rightHandPose READ getRightHandPose)
355 Q_PROPERTY(controller::Pose leftHandTipPose READ getLeftHandTipPose)
356 Q_PROPERTY(controller::Pose rightHandTipPose READ getRightHandTipPose)
358 Q_PROPERTY(
bool isAway READ getIsAway WRITE setAway)
360 Q_PROPERTY(
bool centerOfGravityModelEnabled READ getCenterOfGravityModelEnabled WRITE setCenterOfGravityModelEnabled)
361 Q_PROPERTY(
bool hmdLeanRecenterEnabled READ getHMDLeanRecenterEnabled WRITE setHMDLeanRecenterEnabled)
362 Q_PROPERTY(
bool collisionsEnabled READ getCollisionsEnabled WRITE setCollisionsEnabled)
363 Q_PROPERTY(
bool otherAvatarsCollisionsEnabled READ getOtherAvatarsCollisionsEnabled WRITE setOtherAvatarsCollisionsEnabled)
364 Q_PROPERTY(
bool characterControllerEnabled READ getCharacterControllerEnabled WRITE setCharacterControllerEnabled)
365 Q_PROPERTY(
bool useAdvancedMovementControls READ useAdvancedMovementControls WRITE setUseAdvancedMovementControls)
366 Q_PROPERTY(
bool showPlayArea READ getShowPlayArea WRITE setShowPlayArea)
368 Q_PROPERTY(
float yawSpeed MEMBER _yawSpeed)
369 Q_PROPERTY(
float hmdYawSpeed MEMBER _hmdYawSpeed)
370 Q_PROPERTY(
float pitchSpeed MEMBER _pitchSpeed)
372 Q_PROPERTY(
bool hmdRollControlEnabled READ getHMDRollControlEnabled WRITE setHMDRollControlEnabled)
373 Q_PROPERTY(
float hmdRollControlDeadZone READ getHMDRollControlDeadZone WRITE setHMDRollControlDeadZone)
374 Q_PROPERTY(
float hmdRollControlRate READ getHMDRollControlRate WRITE setHMDRollControlRate)
376 Q_PROPERTY(
float userHeight READ getUserHeight WRITE setUserHeight)
377 Q_PROPERTY(
float userEyeHeight READ getUserEyeHeight)
379 Q_PROPERTY(QUuid SELF_ID READ getSelfID CONSTANT)
381 Q_PROPERTY(
float walkSpeed READ getWalkSpeed WRITE setWalkSpeed);
382 Q_PROPERTY(
float sprintSpeed READ getSprintSpeed WRITE setSprintSpeed NOTIFY sprintSpeedChanged);
383 Q_PROPERTY(
float vrWalkSpeed READ getVrWalkSpeed WRITE setVrWalkSpeed NOTIFY vrWalkSpeedChanged);
384 Q_PROPERTY(
bool isInSittingState READ getIsInSittingState WRITE setIsInSittingState);
385 Q_PROPERTY(MyAvatar::SitStandModelType userRecenterModel READ getUserRecenterModel WRITE setUserRecenterModel);
386 Q_PROPERTY(
bool isSitStandStateLocked READ getIsSitStandStateLocked WRITE setIsSitStandStateLocked);
387 Q_PROPERTY(MyAvatar::AllowAvatarStandingPreference standingMode READ getAllowAvatarStandingPreference WRITE setAllowAvatarStandingPreference NOTIFY standingModeChanged);
388 Q_PROPERTY(
bool allowTeleporting READ getAllowTeleporting)
389 Q_PROPERTY(
float cameraBoomLength MEMBER _boomLength)
391 const QString DOMINANT_LEFT_HAND =
"left";
392 const QString DOMINANT_RIGHT_HAND =
"right";
393 const QString DEFAULT_HMD_AVATAR_ALIGNMENT_TYPE =
"head";
395 using Clock = std::chrono::system_clock;
396 using TimePoint = Clock::time_point;
398 const bool DEFAULT_STRAFE_ENABLED =
true;
509 enum SitStandModelType {
516 Q_ENUM(SitStandModelType)
543 enum class AllowAvatarStandingPreference : uint {
550 Q_ENUM(AllowAvatarStandingPreference)
553 enum class AllowAvatarLeaningPreference : uint {
561 Q_ENUM(AllowAvatarLeaningPreference)
563 static const std::array<QString, (uint)AllowAvatarStandingPreference::Count> allowAvatarStandingPreferenceStrings;
564 static const std::array<QString, (uint)AllowAvatarLeaningPreference::Count> allowAvatarLeaningPreferenceStrings;
566 explicit MyAvatar(QThread* thread);
569 void instantiableAvatar()
override {};
570 static void registerMetaTypes(ScriptEnginePointer engine);
571 void registerProperties(ScriptEnginePointer engine);
573 AudioListenerMode getAudioListenerModeHead()
const {
return FROM_HEAD; }
574 AudioListenerMode getAudioListenerModeCamera()
const {
return FROM_CAMERA; }
575 AudioListenerMode getAudioListenerModeCustom()
const {
return CUSTOM; }
577 void reset(
bool andRecenter =
false,
bool andReload =
true,
bool andHead =
true);
579 void setCollisionWithOtherAvatarsFlags()
override;
585 Q_INVOKABLE
void resetSensorsAndBody();
592 Q_INVOKABLE
void centerBody();
601 Q_INVOKABLE
void clearIKJointLimitHistory();
603 void update(
float deltaTime);
604 virtual void postUpdate(
float deltaTime,
const render::ScenePointer& scene)
override;
605 void preDisplaySide(
const RenderArgs* renderArgs);
607 const glm::mat4& getHMDSensorMatrix()
const {
return _hmdSensorMatrix; }
608 const glm::vec3& getHMDSensorPosition()
const {
return _hmdSensorPosition; }
609 const glm::quat& getHMDSensorOrientation()
const {
return _hmdSensorOrientation; }
616 Q_INVOKABLE
void setOrientationVar(
const QVariant& newOrientationVar);
623 Q_INVOKABLE QVariant getOrientationVar()
const;
626 glm::quat getOrientationOutbound()
const override;
631 void updateFromHMDSensorMatrix(
const glm::mat4& hmdSensorMatrix);
634 glm::vec2 computeHandAzimuth()
const;
637 void updateJointFromController(controller::Action poseKey, ThreadSafeValueCache<glm::mat4>& matrixCache);
642 void updateSensorToWorldMatrix();
644 void setRealWorldFieldOfView(
float realWorldFov) { _realWorldFieldOfView.set(realWorldFov); }
656 Q_INVOKABLE glm::vec3 getDefaultEyePosition()
const;
658 float getRealWorldFieldOfView() {
return _realWorldFieldOfView.get(); }
688 Q_INVOKABLE
void overrideAnimation(
const QString& url,
float fps,
bool loop,
float firstFrame,
float lastFrame);
710 Q_INVOKABLE
void overrideHandAnimation(
bool isLeft,
const QString& url,
float fps,
bool loop,
float firstFrame,
float lastFrame);
727 Q_INVOKABLE
void restoreAnimation();
744 Q_INVOKABLE
void restoreHandAnimation(
bool isLeft);
762 Q_INVOKABLE QStringList getAnimationRoles();
802 Q_INVOKABLE
void overrideRoleAnimation(
const QString& role,
const QString& url,
float fps,
bool loop,
float firstFrame,
float lastFrame);
817 Q_INVOKABLE
void restoreRoleAnimation(
const QString& role);
858 Q_INVOKABLE
ScriptValue addAnimationStateHandler(
const ScriptValue& handler,
const ScriptValue& propertiesList) {
return _skeletonModel->getRig().addAnimationStateHandler(handler, propertiesList); }
866 Q_INVOKABLE
void removeAnimationStateHandler(
const ScriptValue& handler) { _skeletonModel->getRig().removeAnimationStateHandler(handler); }
875 Q_INVOKABLE
bool getSnapTurn()
const {
return _useSnapTurn; }
882 Q_INVOKABLE
void setSnapTurn(
bool on) { _useSnapTurn = on; }
891 Q_INVOKABLE
bool hoverWhenUnsupported()
const {
return _hoverWhenUnsupported; }
899 Q_INVOKABLE
void setHoverWhenUnsupported(
bool on) { _hoverWhenUnsupported = on; }
907 Q_INVOKABLE
void setDominantHand(
const QString& hand);
914 Q_INVOKABLE QString getDominantHand()
const;
921 Q_INVOKABLE
void setStrafeEnabled(
bool enabled);
928 Q_INVOKABLE
bool getStrafeEnabled()
const;
936 Q_INVOKABLE
void setHmdAvatarAlignmentType(
const QString& type);
944 Q_INVOKABLE QString getHmdAvatarAlignmentType()
const;
952 Q_INVOKABLE
void setCenterOfGravityModelEnabled(
bool value) { _centerOfGravityModelEnabled = value; }
960 Q_INVOKABLE
bool getCenterOfGravityModelEnabled()
const {
return _centerOfGravityModelEnabled; }
970 Q_INVOKABLE
void setHMDLeanRecenterEnabled(
bool value) { _hmdLeanRecenterEnabled = value; }
978 Q_INVOKABLE
bool getHMDLeanRecenterEnabled()
const {
return _hmdLeanRecenterEnabled; }
987 Q_INVOKABLE
void requestEnableHandTouch();
996 Q_INVOKABLE
void requestDisableHandTouch();
1005 Q_INVOKABLE
void disableHandTouchForID(
const QUuid& entityID);
1014 Q_INVOKABLE
void enableHandTouchForID(
const QUuid& entityID);
1016 bool useAdvancedMovementControls()
const {
return _useAdvancedMovementControls.get(); }
1017 void setUseAdvancedMovementControls(
bool useAdvancedMovementControls)
1018 { _useAdvancedMovementControls.set(useAdvancedMovementControls); }
1020 bool getAllowTeleporting() {
return _allowTeleportingSetting.get(); }
1021 void setAllowTeleporting(
bool allowTeleporting) { _allowTeleportingSetting.set(allowTeleporting); }
1023 bool getShowPlayArea()
const {
return _showPlayArea.get(); }
1024 void setShowPlayArea(
bool showPlayArea) { _showPlayArea.set(showPlayArea); }
1026 void setHMDRollControlEnabled(
bool value) { _hmdRollControlEnabled = value; }
1027 bool getHMDRollControlEnabled()
const {
return _hmdRollControlEnabled; }
1028 void setHMDRollControlDeadZone(
float value) { _hmdRollControlDeadZone = value; }
1029 float getHMDRollControlDeadZone()
const {
return _hmdRollControlDeadZone; }
1030 void setHMDRollControlRate(
float value) { _hmdRollControlRate = value; }
1031 float getHMDRollControlRate()
const {
return _hmdRollControlRate; }
1034 void resizeAvatarEntitySettingHandles(uint32_t maxIndex);
1036 void saveAvatarEntityDataToSettings();
1038 void loadAvatarEntityDataFromSettings();
1041 void clearDriveKeys();
1042 void setDriveKey(DriveKeys key,
float val);
1043 void setSprintMode(
bool sprint);
1044 float getDriveKey(DriveKeys key)
const;
1052 Q_INVOKABLE
float getRawDriveKey(DriveKeys key)
const;
1054 void relayDriveKeysToCharacterController();
1068 Q_INVOKABLE
void disableDriveKey(DriveKeys key);
1076 Q_INVOKABLE
void enableDriveKey(DriveKeys key);
1084 Q_INVOKABLE
bool isDriveKeyDisabled(DriveKeys key)
const;
1092 Q_INVOKABLE
void triggerVerticalRecenter();
1099 Q_INVOKABLE
void triggerHorizontalRecenter();
1105 Q_INVOKABLE
void triggerRotationRecenter();
1113 Q_INVOKABLE
bool isRecenteringHorizontally()
const;
1115 eyeContactTarget getEyeContactTarget();
1117 const MyHead* getMyHead()
const;
1126 Q_INVOKABLE glm::vec3 getHeadPosition()
const {
return getHead()->getPosition(); }
1133 Q_INVOKABLE
float getHeadFinalYaw()
const {
return getHead()->getFinalYaw(); }
1140 Q_INVOKABLE
float getHeadFinalRoll()
const {
return getHead()->getFinalRoll(); }
1147 Q_INVOKABLE
float getHeadFinalPitch()
const {
return getHead()->getFinalPitch(); }
1156 Q_INVOKABLE
float getHeadDeltaPitch()
const {
return getHead()->getDeltaPitch(); }
1166 Q_INVOKABLE glm::vec3 getEyePosition()
const {
return getHead()->getEyePosition(); }
1177 Q_INVOKABLE glm::vec3 getTargetAvatarPosition()
const {
return _targetAvatarPosition; }
1184 Q_INVOKABLE ScriptAvatarData* getTargetAvatar()
const;
1198 Q_INVOKABLE glm::vec3 getLeftHandPosition()
const;
1211 Q_INVOKABLE glm::vec3 getRightHandPosition()
const;
1220 Q_INVOKABLE glm::vec3 getLeftHandTipPosition()
const;
1229 Q_INVOKABLE glm::vec3 getRightHandTipPosition()
const;
1243 Q_INVOKABLE controller::Pose getLeftHandPose()
const;
1256 Q_INVOKABLE controller::Pose getRightHandPose()
const;
1268 Q_INVOKABLE controller::Pose getLeftHandTipPose()
const;
1280 Q_INVOKABLE controller::Pose getRightHandTipPose()
const;
1282 AvatarWeakPointer getLookAtTargetAvatar()
const {
return _lookAtTargetAvatar; }
1283 void updateLookAtTargetAvatar();
1284 void computeMyLookAtTarget(
const AvatarHash& hash);
1285 void snapOtherAvatarLookAtTargetsToMe(
const AvatarHash& hash);
1286 void clearLookAtTargetAvatar();
1288 virtual void setJointRotations(
const QVector<glm::quat>& jointRotations)
override;
1289 virtual void setJointData(
int index,
const glm::quat& rotation,
const glm::vec3& translation)
override;
1290 virtual void setJointRotation(
int index,
const glm::quat& rotation)
override;
1291 virtual void setJointTranslation(
int index,
const glm::vec3& translation)
override;
1292 virtual void clearJointData(
int index)
override;
1294 virtual void setJointData(
const QString& name,
const glm::quat& rotation,
const glm::vec3& translation)
override;
1295 virtual void setJointRotation(
const QString& name,
const glm::quat& rotation)
override;
1296 virtual void setJointTranslation(
const QString& name,
const glm::vec3& translation)
override;
1297 virtual void clearJointData(
const QString& name)
override;
1298 virtual void clearJointsData()
override;
1309 Q_INVOKABLE
bool pinJoint(
int index,
const glm::vec3& position,
const glm::quat& orientation);
1311 bool isJointPinned(
int index);
1320 Q_INVOKABLE
bool clearPinOnJoint(
int index);
1327 Q_INVOKABLE
float getIKErrorOnLastSolve()
const;
1335 Q_INVOKABLE
void useFullAvatarURL(
const QUrl& fullAvatarURL,
const QString& modelName = QString());
1344 Q_INVOKABLE QUrl getFullAvatarURLFromPreferences()
const {
return _fullAvatarURLFromPreferences; }
1353 Q_INVOKABLE QString getFullAvatarModelName()
const {
return _fullAvatarModelName; }
1355 void resetFullAvatarURL();
1357 MyCharacterController* getCharacterController() {
return &_characterController; }
1358 const MyCharacterController* getCharacterController()
const {
return &_characterController; }
1360 void updateMotors();
1361 void prepareForPhysicsSimulation();
1362 void nextAttitude(glm::vec3 position, glm::quat orientation);
1363 void harvestResultsFromPhysicsSimulation(
float deltaTime);
1365 const QString& getCollisionSoundURL() {
return _collisionSoundURL; }
1366 void setCollisionSoundURL(
const QString& url);
1368 SharedSoundPointer getCollisionSound();
1369 void setCollisionSound(SharedSoundPointer sound) { _collisionSound = sound; }
1371 void clearScriptableSettings();
1373 float getBoomLength()
const {
return _boomLength; }
1374 void setBoomLength(
float boomLength) { _boomLength = boomLength; }
1376 float getPitchSpeed()
const {
return _pitchSpeed; }
1377 void setPitchSpeed(
float speed) { _pitchSpeed = speed; }
1379 float getYawSpeed()
const {
return _yawSpeed; }
1380 void setYawSpeed(
float speed) { _yawSpeed = speed; }
1382 float getHMDYawSpeed()
const {
return _hmdYawSpeed; }
1383 void setHMDYawSpeed(
float speed) { _hmdYawSpeed = speed; }
1385 float getCameraSensitivity()
const;
1386 void setCameraSensitivity(
float cameraSensitivity);
1388 static const float ZOOM_MIN;
1389 static const float ZOOM_MAX;
1390 static const float ZOOM_DEFAULT;
1392 void destroyAnimGraph();
1394 AudioListenerMode getAudioListenerMode() {
return _audioListenerMode; }
1395 void setAudioListenerMode(AudioListenerMode audioListenerMode);
1396 glm::vec3 getCustomListenPosition() {
return _customListenPosition; }
1397 void setCustomListenPosition(glm::vec3 customListenPosition) { _customListenPosition = customListenPosition; }
1398 glm::quat getCustomListenOrientation() {
return _customListenOrientation; }
1399 void setCustomListenOrientation(glm::quat customListenOrientation) { _customListenOrientation = customListenOrientation; }
1401 virtual void rebuildCollisionShape()
override;
1403 const glm::vec2& getHipToHandController()
const {
return _hipToHandController; }
1404 void setHipToHandController(glm::vec2 currentHipToHandController) { _hipToHandController = currentHipToHandController; }
1405 const glm::vec2& getHeadControllerFacing()
const {
return _headControllerFacing; }
1406 void setHeadControllerFacing(glm::vec2 currentHeadControllerFacing) { _headControllerFacing = currentHeadControllerFacing; }
1407 const glm::vec2& getHeadControllerFacingMovingAverage()
const {
return _headControllerFacingMovingAverage; }
1408 void setHeadControllerFacingMovingAverage(glm::vec2 currentHeadControllerFacing) { _headControllerFacingMovingAverage = currentHeadControllerFacing; }
1409 float getCurrentStandingHeight()
const {
return _currentStandingHeight; }
1410 void setCurrentStandingHeight(
float newMode) { _currentStandingHeight = newMode; }
1411 const glm::quat getAverageHeadRotation()
const {
return _averageHeadRotation; }
1412 void setAverageHeadRotation(glm::quat rotation) { _averageHeadRotation = rotation; }
1413 bool getResetMode()
const {
return _resetMode; }
1414 void setResetMode(
bool hasBeenReset) { _resetMode = hasBeenReset; }
1416 void setControllerPoseInSensorFrame(controller::Action action,
const controller::Pose& pose);
1417 controller::Pose getControllerPoseInSensorFrame(controller::Action action)
const;
1418 controller::Pose getControllerPoseInWorldFrame(controller::Action action)
const;
1419 controller::Pose getControllerPoseInAvatarFrame(controller::Action action)
const;
1421 bool hasDriveInput()
const;
1428 Q_INVOKABLE QVariantList getAvatarEntitiesVariant();
1430 void removeWornAvatarEntity(
const EntityItemID& entityID);
1431 void clearWornAvatarEntities();
1432 bool hasAvatarEntities()
const;
1439 Q_INVOKABLE
bool isFlying();
1447 Q_INVOKABLE
bool isInAir();
1456 Q_INVOKABLE
void setFlyingEnabled(
bool enabled);
1465 Q_INVOKABLE
bool getFlyingEnabled();
1474 Q_INVOKABLE
void setFlyingDesktopPref(
bool enabled);
1483 Q_INVOKABLE
bool getFlyingDesktopPref();
1492 Q_INVOKABLE
void setFlyingHMDPref(
bool enabled);
1501 Q_INVOKABLE
bool getFlyingHMDPref();
1509 Q_INVOKABLE
void setMovementReference(
int enabled);
1517 Q_INVOKABLE
int getMovementReference();
1525 Q_INVOKABLE
float getAvatarScale()
const;
1533 Q_INVOKABLE
void setAvatarScale(
float scale);
1544 Q_INVOKABLE
void setCollisionsEnabled(
bool enabled);
1552 Q_INVOKABLE
bool getCollisionsEnabled();
1560 Q_INVOKABLE
void setOtherAvatarsCollisionsEnabled(
bool enabled);
1567 Q_INVOKABLE
bool getOtherAvatarsCollisionsEnabled();
1576 Q_INVOKABLE QVariantMap getCollisionCapsule()
const;
1584 Q_INVOKABLE
void setCharacterControllerEnabled(
bool enabled);
1591 Q_INVOKABLE
bool getCharacterControllerEnabled();
1604 virtual glm::quat getAbsoluteJointRotationInObjectFrame(
int index)
const override;
1617 virtual glm::vec3 getAbsoluteJointTranslationInObjectFrame(
int index)
const override;
1620 glm::mat4 getCenterEyeCalibrationMat()
const;
1621 glm::mat4 getHeadCalibrationMat()
const;
1622 glm::mat4 getSpine2CalibrationMat()
const;
1623 glm::mat4 getHipsCalibrationMat()
const;
1624 glm::mat4 getLeftFootCalibrationMat()
const;
1625 glm::mat4 getRightFootCalibrationMat()
const;
1626 glm::mat4 getRightArmCalibrationMat()
const;
1627 glm::mat4 getLeftArmCalibrationMat()
const;
1628 glm::mat4 getLeftHandCalibrationMat()
const;
1629 glm::mat4 getRightHandCalibrationMat()
const;
1631 void addHoldAction(AvatarActionHold* holdAction);
1632 void removeHoldAction(AvatarActionHold* holdAction);
1633 void updateHoldActions(
const AnimPose& prePhysicsPose,
const AnimPose& postUpdatePose);
1638 glm::mat4 deriveBodyFromHMDSensor(
const bool forceFollowYPos =
false)
const;
1640 glm::mat4 getSpine2RotationRigSpace()
const;
1642 glm::vec3 computeCounterBalance();
1647 glm::mat4 deriveBodyUsingCgModel();
1657 Q_INVOKABLE
bool isUp(
const glm::vec3& direction) {
return glm::dot(direction, _worldUpDirection) > 0.0f; };
1667 Q_INVOKABLE
bool isDown(
const glm::vec3& direction) {
return glm::dot(direction, _worldUpDirection) < 0.0f; };
1669 void setUserHeight(
float value);
1670 float getUserHeight()
const;
1671 float getUserEyeHeight()
const;
1673 virtual SpatialParentTree* getParentTree()
const override;
1674 virtual glm::vec3 scaleForChildren()
const override {
return glm::vec3(getSensorToWorldScale()); }
1676 const QUuid& getSelfID()
const {
return AVATAR_SELF_ID; }
1678 void setIsInWalkingState(
bool isWalking);
1679 bool getIsInWalkingState()
const;
1680 void setIsInSittingState(
bool isSitting);
1681 bool getIsInSittingState()
const;
1682 void setUserRecenterModel(MyAvatar::SitStandModelType modelName);
1683 MyAvatar::SitStandModelType getUserRecenterModel()
const;
1684 void setIsSitStandStateLocked(
bool isLocked);
1685 bool getIsSitStandStateLocked()
const;
1686 void setAllowAvatarStandingPreference(
const AllowAvatarStandingPreference preference);
1687 AllowAvatarStandingPreference getAllowAvatarStandingPreference()
const;
1688 void setAllowAvatarLeaningPreference(
const AllowAvatarLeaningPreference preference);
1689 AllowAvatarLeaningPreference getAllowAvatarLeaningPreference()
const;
1690 void setWalkSpeed(
float value);
1691 float getWalkSpeed()
const;
1692 void setSprintSpeed(
float value);
1693 float getSprintSpeed()
const;
1694 void setVrWalkSpeed(
float value);
1695 float getVrWalkSpeed()
const;
1696 void setSitStandStateChange(
bool stateChanged);
1697 bool getSitStandStateChange()
const;
1698 void updateSitStandState(
float newHeightReading,
float dt);
1700 QVector<QString> getScriptUrls();
1702 bool isReadyForPhysics()
const;
1704 float computeStandingHeightMode(
const controller::Pose& head);
1705 glm::quat computeAverageHeadRotation(
const controller::Pose& head);
1707 glm::vec3 getNextPosition() {
return _goToPending ? _goToPosition : getWorldPosition(); }
1708 void prepareAvatarEntityDataForReload();
1717 Q_INVOKABLE
void setHeadLookAt(
const glm::vec3& lookAtTarget);
1724 Q_INVOKABLE glm::vec3 getHeadLookAt() {
return _lookAtCameraTarget; }
1730 Q_INVOKABLE
void releaseHeadLookAtControl();
1739 Q_INVOKABLE
void setEyesLookAt(
const glm::vec3& lookAtTarget);
1746 Q_INVOKABLE glm::vec3 getEyesLookAt() {
return _eyesLookAtTarget.get(); }
1752 Q_INVOKABLE
void releaseEyesLookAtControl();
1762 Q_INVOKABLE
bool setPointAt(
const glm::vec3& pointAtTarget);
1764 glm::quat getLookAtRotation() {
return _lookAtYaw * _lookAtPitch; }
1793 Q_INVOKABLE
const QUuid grab(
const QUuid& targetID,
int parentJointIndex,
1794 glm::vec3 positionalOffset, glm::quat rotationalOffset);
1801 Q_INVOKABLE
void releaseGrab(
const QUuid& grabID);
1812 AvatarEntityMap getAvatarEntityData()
const override;
1814 AvatarEntityMap getAvatarEntityDataNonDefault()
const override;
1821 void setAvatarEntityData(
const AvatarEntityMap& avatarEntityData)
override;
1826 void updateAvatarEntity(
const QUuid& entityID,
const QByteArray& entityData)
override;
1828 void avatarEntityDataToJson(QJsonObject& root)
const override;
1830 void storeAvatarEntityDataPayload(
const QUuid& entityID,
const QByteArray& payload)
override;
1835 int sendAvatarDataPacket(
bool sendAll =
false)
override;
1837 void addAvatarHandsToFlow(
const std::shared_ptr<Avatar>& otherAvatar);
1852 Q_INVOKABLE
void useFlow(
bool isActive,
bool isCollidable,
const QVariantMap& physicsConfig = QVariantMap(),
const QVariantMap& collisionsConfig = QVariantMap());
1859 Q_INVOKABLE QVariantMap getFlowData();
1866 Q_INVOKABLE QVariantList getCollidingFlowJoints();
1874 Q_INVOKABLE
void beginSit(
const glm::vec3& position,
const glm::quat& rotation);
1882 Q_INVOKABLE
void endSit(
const glm::vec3& position,
const glm::quat& rotation);
1889 Q_INVOKABLE
bool isSeated() {
return _characterController.getSeated(); }
1891 int getOverrideJointCount()
const;
1892 bool getFlowActive()
const;
1893 bool getNetworkGraphActive()
const;
1895 void updateEyesLookAtPosition(
float deltaTime);
1899 void updateRigControllerParameters(Rig::ControllerParameters& params);
1902 virtual const QUrl& getSkeletonModelURL()
const override {
return _skeletonModelURL; }
1904 void debugDrawPose(controller::Action action,
const char* channelName,
float size);
1906 bool getIsJointOverridden(
int jointIndex)
const;
1907 glm::vec3 getLookAtPivotPoint();
1908 glm::vec3 getCameraEyesPosition(
float deltaTime);
1910 bool getHMDCrouchRecenterEnabled()
const;
1911 bool isAllowedToLean()
const;
1912 bool areFeetTracked()
const {
return _isBodyPartTracked._feet; };
1913 bool areHipsTracked()
const {
return _isBodyPartTracked._hips; };
1920 virtual void setSessionUUID(
const QUuid& sessionUUID)
override;
1933 void increaseSize();
1946 void decreaseSize();
1958 void animGraphLoaded();
1965 void setGravity(
float gravity);
1985 void goToFeetLocation(
const glm::vec3& newPosition,
bool hasOrientation =
false,
1986 const glm::quat& newOrientation = glm::quat(),
bool shouldFaceLocation =
false);
1998 void goToLocation(
const glm::vec3& newPosition,
1999 bool hasOrientation =
false,
const glm::quat& newOrientation = glm::quat(),
2000 bool shouldFaceLocation =
false,
bool withSafeLanding =
true);
2006 void goToLocation(
const QVariant& properties);
2013 void goToLocationAndEnableCollisions(
const glm::vec3& newPosition);
2021 bool safeLanding(
const glm::vec3& position);
2029 void restrictScaleFromDomainSettings(
const QJsonObject& domainSettingsObject);
2035 void clearScaleRestriction();
2046 void addThrust(glm::vec3 newThrust) { _thrust += newThrust; };
2055 glm::vec3 getThrust() {
return _thrust; };
2064 void setThrust(glm::vec3 newThrust) { _thrust = newThrust; }
2072 Q_INVOKABLE
void updateMotionBehaviorFromMenu();
2079 void setToggleHips(
bool followHead);
2088 void setEnableDebugDrawBaseOfSupport(
bool isEnabled);
2095 void setEnableDebugDrawDefaultPose(
bool isEnabled);
2103 void setEnableDebugDrawAnimPose(
bool isEnabled);
2112 void setDebugDrawAnimPoseName(QString poseName);
2119 void setEnableDebugDrawPosition(
bool isEnabled);
2126 void setEnableDebugDrawHandControllers(
bool isEnabled);
2133 void setEnableDebugDrawSensorToWorldMatrix(
bool isEnabled);
2140 void setEnableDebugDrawIKTargets(
bool isEnabled);
2147 void setEnableDebugDrawIKConstraints(
bool isEnabled);
2154 void setEnableDebugDrawIKChains(
bool isEnabled);
2161 void setEnableDebugDrawDetailedCollision(
bool isEnabled);
2168 bool getEnableMeshVisible()
const override;
2173 void clearAvatarEntity(
const QUuid& entityID,
bool requiresRemovalFromTree =
true)
override;
2185 virtual void setEnableMeshVisible(
bool isEnabled)
override;
2192 void setEnableInverseKinematics(
bool isEnabled);
2203 QUrl getAnimGraphOverrideUrl()
const;
2212 void setAnimGraphOverrideUrl(QUrl value);
2223 QUrl getAnimGraphUrl()
const;
2232 void setAnimGraphUrl(
const QUrl& url);
2240 glm::vec3 getPositionForAudio();
2248 glm::quat getOrientationForAudio();
2255 virtual void setModelScale(
float scale)
override;
2265 QStringList getTriggerReactions()
const;
2278 QStringList getBeginEndReactions()
const;
2287 bool triggerReaction(QString reactionName);
2297 bool beginReaction(QString reactionName);
2305 bool endReaction(QString reactionName);
2314 void audioListenerModeChanged();
2322 void vrWalkSpeedChanged(
float value);
2330 void sprintSpeedChanged(
float value);
2338 void standingModeChanged(MyAvatar::AllowAvatarStandingPreference mode);
2345 void transformChanged();
2353 void newCollisionSoundURL(
const QUrl& url);
2365 void collisionWithEntity(
const Collision& collision);
2374 void collisionsEnabledChanged(
bool enabled);
2383 void otherAvatarsCollisionsEnabledChanged(
bool enabled);
2394 void animGraphUrlChanged(
const QUrl& url);
2402 void positionGoneTo();
2409 void onLoadComplete();
2416 void onLoadFailed();
2443 void skeletonChanged();
2451 void dominantHandChanged(
const QString& hand);
2460 void hmdAvatarAlignmentTypeChanged(
const QString& type);
2469 void sensorToWorldScaleChanged(
float sensorToWorldScale);
2477 void scaleChanged();
2488 void shouldDisableHandTouchChanged(
bool shouldDisable);
2500 void disableHandTouchForIDChanged(
const QUuid& entityID,
bool disable);
2504 void updateCollisionCapsuleCache();
2507 void handleChangedAvatarEntityData();
2508 void handleCanRezAvatarEntitiesChanged(
bool canRezAvatarEntities);
2509 virtual void beParentOfChild(SpatiallyNestablePointer newChild)
const override;
2510 virtual void forgetChild(SpatiallyNestablePointer newChild)
const override;
2511 virtual void recalculateChildCauterization()
const override;
2514 bool updateStaleAvatarEntityBlobs()
const;
2516 bool requiresSafeLanding(
const glm::vec3& positionIn, glm::vec3& positionOut);
2518 virtual QByteArray toByteArrayStateful(AvatarDataDetail dataDetail,
bool dropFaceTracking)
override;
2520 void simulate(
float deltaTime,
bool inView)
override;
2521 void saveAvatarUrl();
2522 virtual void render(RenderArgs* renderArgs)
override;
2523 virtual bool shouldRenderHead(
const RenderArgs* renderArgs)
const override;
2524 void setShouldRenderLocally(
bool shouldRender) { _shouldRender = shouldRender; setEnableMeshVisible(shouldRender); }
2525 bool getShouldRenderLocally()
const {
return _shouldRender; }
2526 void setRotationRecenterFilterLength(
float length);
2527 float getRotationRecenterFilterLength()
const {
return _rotationRecenterFilterLength; }
2528 void setRotationThreshold(
float angleRadians);
2529 float getRotationThreshold()
const {
return _rotationThreshold; }
2530 void setEnableStepResetRotation(
bool stepReset) { _stepResetRotationEnabled = stepReset; }
2531 bool getEnableStepResetRotation()
const {
return _stepResetRotationEnabled; }
2532 void setEnableDrawAverageFacing(
bool drawAverage) { _drawAverageFacingEnabled = drawAverage; }
2533 bool getEnableDrawAverageFacing()
const {
return _drawAverageFacingEnabled; }
2534 virtual bool isMyAvatar()
const override {
return true; }
2535 virtual bool isMyAvatarURLProtected()
const override;
2536 virtual int parseDataFromBuffer(
const QByteArray& buffer)
override;
2537 virtual glm::vec3 getSkeletonPosition()
const override;
2538 int _skeletonModelChangeCount { 0 };
2539 void sanitizeAvatarEntityProperties(EntityItemProperties& properties)
const;
2541 void saveAvatarScale();
2543 glm::vec3 getScriptedMotorVelocity()
const {
return _scriptedMotorVelocity; }
2544 float getScriptedMotorTimescale()
const {
return _scriptedMotorTimescale; }
2545 QString getScriptedMotorFrame()
const;
2546 QString getScriptedMotorMode()
const;
2547 void setScriptedMotorVelocity(
const glm::vec3& velocity);
2548 void setScriptedMotorTimescale(
float timescale);
2549 void setScriptedMotorFrame(QString frame);
2550 void setScriptedMotorMode(QString mode);
2553 bool findAvatarEntity(
const QString& modelURL,
const QString& jointName, QUuid& entityID);
2554 void addAvatarEntitiesToTree();
2557 void clearAvatarEntityInternal(
const QUuid& entityID)
override;
2559 bool cameraInsideHead(
const glm::vec3& cameraPosition)
const;
2561 void updateEyeContactTarget(
float deltaTime);
2567 Q_INVOKABLE
virtual void setSkeletonModelURL(
const QUrl& skeletonModelURL)
override;
2569 virtual void updatePalms()
override {}
2570 void lateUpdatePalms();
2571 void setSitDriveKeysStatus(
bool enabled);
2573 void clampTargetScaleToDomainLimits();
2574 void clampScaleChangeToDomainLimits(
float desiredScale);
2575 glm::mat4 computeCameraRelativeHandControllerMatrix(
const glm::mat4& controllerSensorMatrix)
const;
2577 std::array<float, MAX_DRIVE_KEYS> _driveKeys;
2578 std::bitset<MAX_DRIVE_KEYS> _disabledDriveKeys;
2580 bool _enableFlying {
false };
2581 bool _flyingPrefDesktop {
true };
2582 bool _flyingPrefHMD {
true };
2583 bool _wasPushing {
false };
2584 bool _isPushing {
false };
2585 bool _isBeingPushed {
false };
2586 bool _isBraking {
false };
2587 bool _isAway {
false };
2591 bool _feet {
false };
2592 bool _feetPreviousUpdate{
false };
2593 bool _hips{
false };
2594 bool _leftHand{
false };
2595 bool _rightHand{
false };
2596 bool _head{
false };
2597 } _isBodyPartTracked;
2599 float _boomLength { ZOOM_DEFAULT };
2603 int _movementReference{ 0 };
2605 glm::vec3 _thrust { 0.0f };
2607 glm::vec3 _actionMotorVelocity;
2608 glm::vec3 _scriptedMotorVelocity;
2609 float _scriptedMotorTimescale;
2610 int _scriptedMotorFrame;
2611 int _scriptedMotorMode;
2612 quint32 _motionBehaviors;
2613 QString _collisionSoundURL;
2615 SharedSoundPointer _collisionSound;
2617 MyCharacterController _characterController;
2618 int32_t _previousCollisionMask { BULLET_COLLISION_MASK_MY_AVATAR };
2620 AvatarWeakPointer _lookAtTargetAvatar;
2621 glm::vec3 _targetAvatarPosition;
2622 bool _shouldRender {
true };
2623 float _oculusYawOffset;
2625 eyeContactTarget _eyeContactTarget;
2626 float _eyeContactTargetTimer { 0.0f };
2627 ThreadSafeValueCache<glm::vec3> _eyesLookAtTarget { glm::vec3() };
2628 bool _scriptControlsEyesLookAt{
false };
2629 float _scriptEyesControlTimer{ 0.0f };
2631 glm::vec3 _trackedHeadPosition;
2633 const float MAX_LOOK_AT_TIME_SCRIPT_CONTROL = 2.0f;
2634 glm::quat _lookAtPitch;
2635 glm::quat _lookAtYaw;
2636 float _lookAtYawSpeed { 0.0f };
2637 glm::vec3 _lookAtCameraTarget;
2638 glm::vec3 _lookAtScriptTarget;
2639 bool _headLookAtActive {
false };
2640 bool _shouldTurnToFaceCamera {
false };
2641 bool _scriptControlsHeadLookAt {
false };
2642 float _scriptHeadControlTimer { 0.0f };
2643 float _firstPersonSteadyHeadTimer { 0.0f };
2644 bool _pointAtActive {
false };
2645 bool _isPointTargetValid {
true };
2652 const float SMOOTH_TIME_ORIENTATION = 0.5f;
2655 float _smoothOrientationTimer;
2656 glm::quat _smoothOrientationInitial;
2657 glm::quat _smoothOrientationTarget;
2660 void updateOrientation(
float deltaTime);
2661 glm::vec3 calculateScaledDirection();
2662 glm::vec3 scaleMotorSpeed(
const glm::vec3 forward,
const glm::vec3 right);
2663 void updateActionMotor(
float deltaTime);
2664 void updatePosition(
float deltaTime);
2665 void updateViewBoom();
2666 void updateCollisionSound(
const glm::vec3& penetration,
float deltaTime,
float frequency);
2667 void initHeadBones();
2668 void initAnimGraph();
2669 void initFlowFromFST();
2670 void updateHeadLookAt(
float deltaTime);
2671 void resetHeadLookAt();
2672 void resetLookAtRotation(
const glm::vec3& avatarPosition,
const glm::quat& avatarOrientation);
2673 void resetPointAt();
2674 static glm::vec3 aimToBlendValues(
const glm::vec3& aimVector,
const glm::quat& frameOrientation);
2675 void centerBodyInternal(
const bool forceFollowYPos =
false);
2678 QUrl _fullAvatarURLFromPreferences;
2679 QString _fullAvatarModelName;
2680 ThreadSafeValueCache<QUrl> _currentAnimGraphUrl;
2681 ThreadSafeValueCache<QUrl> _prefOverrideAnimGraphUrl;
2682 QUrl _fstAnimGraphOverrideUrl;
2683 bool _useSnapTurn {
true };
2684 bool _hoverWhenUnsupported{
false };
2685 ThreadSafeValueCache<QString> _dominantHand { DOMINANT_RIGHT_HAND };
2686 ThreadSafeValueCache<QString> _hmdAvatarAlignmentType { DEFAULT_HMD_AVATAR_ALIGNMENT_TYPE };
2687 ThreadSafeValueCache<bool> _strafeEnabled{ DEFAULT_STRAFE_ENABLED };
2689 const float ROLL_CONTROL_DEAD_ZONE_DEFAULT = 8.0f;
2690 const float ROLL_CONTROL_RATE_DEFAULT = 114.0f;
2692 bool _hmdRollControlEnabled {
true };
2693 float _hmdRollControlDeadZone { ROLL_CONTROL_DEAD_ZONE_DEFAULT };
2694 float _hmdRollControlRate { ROLL_CONTROL_RATE_DEFAULT };
2695 std::atomic<bool> _hasScriptedBlendShapes {
false };
2696 std::atomic<float> _rotationRecenterFilterLength { 4.0f };
2697 std::atomic<float> _rotationThreshold { 0.5235f };
2698 std::atomic<bool> _stepResetRotationEnabled {
true };
2699 std::atomic<bool> _drawAverageFacingEnabled {
false };
2702 glm::mat4 _sensorToWorldMatrix { glm::mat4() };
2705 glm::mat4 _hmdSensorMatrix;
2706 glm::quat _hmdSensorOrientation;
2707 glm::vec3 _hmdSensorPosition;
2709 glm::vec2 _headControllerFacing;
2710 glm::vec2 _headControllerFacingMovingAverage { 0.0f, 0.0f };
2711 glm::quat _averageHeadRotation { 0.0f, 0.0f, 0.0f, 1.0f };
2713 glm::vec2 _hipToHandController { 0.0f, 1.0f };
2715 float _currentStandingHeight { 0.0f };
2716 bool _resetMode {
true };
2717 RingBufferHistory<int> _recentModeReadings;
2721 glm::mat4 _bodySensorMatrix;
2723 struct FollowHelper {
2726 CharacterController::FollowTimePerType _timeRemaining;
2729 void deactivate(CharacterController::FollowType type);
2730 void activate(CharacterController::FollowType type,
const bool snapFollow);
2731 bool isActive()
const;
2732 bool isActive(CharacterController::FollowType followType)
const;
2733 void decrementTimeRemaining(
float dt);
2734 bool shouldActivateRotation(
const MyAvatar& myAvatar,
const glm::mat4& desiredBodyMatrix,
const glm::mat4& currentBodyMatrix,
bool& shouldSnapOut)
const;
2735 bool shouldActivateVertical(
const MyAvatar& myAvatar,
const glm::mat4& desiredBodyMatrix,
const glm::mat4& currentBodyMatrix)
const;
2736 bool shouldActivateHorizontal(
const MyAvatar& myAvatar,
2737 const glm::mat4& desiredBodyMatrix,
2738 const glm::mat4& currentBodyMatrix,
2740 bool& goToWalkingStateOut)
const;
2741 void prePhysicsUpdate(MyAvatar& myAvatar,
const glm::mat4& bodySensorMatrix,
const glm::mat4& currentBodyMatrix,
bool hasDriveInput);
2742 glm::mat4 postPhysicsUpdate(MyAvatar& myAvatar,
const glm::mat4& currentBodyMatrix);
2743 bool getForceActivateRotation()
const;
2744 void setForceActivateRotation(
bool val);
2745 bool getForceActivateVertical()
const;
2746 void setForceActivateVertical(
bool val);
2747 bool getForceActivateHorizontal()
const;
2748 void setForceActivateHorizontal(
bool val);
2749 std::atomic<bool> _forceActivateRotation {
false };
2750 std::atomic<bool> _forceActivateVertical {
false };
2751 std::atomic<bool> _forceActivateHorizontal {
false };
2752 std::atomic<bool> _toggleHipsFollowing {
true };
2755 bool shouldActivateHorizontal_userSitting(
const MyAvatar& myAvatar,
2756 const glm::mat4& desiredBodyMatrix,
2757 const glm::mat4& currentBodyMatrix)
const;
2758 bool shouldActivateHorizontal_userStanding(
const MyAvatar& myAvatar,
2760 bool& goToWalkingStateOut)
const;
2763 FollowHelper _follow;
2765 bool isFollowActive(CharacterController::FollowType followType)
const;
2767 bool _goToPending {
false };
2768 bool _physicsSafetyPending {
false };
2769 bool _goToSafe {
true };
2770 bool _goToFeetAjustment {
false };
2771 glm::vec3 _goToPosition;
2772 glm::quat _goToOrientation;
2774 std::unordered_set<int> _headBoneSet;
2775 std::unordered_set<SpatiallyNestablePointer> _cauterizedChildrenOfHead;
2776 bool _prevShouldDrawHead;
2777 bool _rigEnabled {
true };
2779 bool _enableDebugDrawBaseOfSupport {
false };
2780 bool _enableDebugDrawDefaultPose {
false };
2781 bool _enableDebugDrawAnimPose {
false };
2782 bool _enableDebugDrawHandControllers {
false };
2783 bool _enableDebugDrawSensorToWorldMatrix {
false };
2784 bool _enableDebugDrawIKTargets {
false };
2785 bool _enableDebugDrawIKConstraints {
false };
2786 bool _enableDebugDrawIKChains {
false };
2787 bool _enableDebugDrawDetailedCollision {
false };
2789 ThreadSafeValueCache<QString> _debugDrawAnimPoseName;
2791 mutable bool _cauterizationNeedsUpdate {
false };
2793 AudioListenerMode _audioListenerMode;
2794 glm::vec3 _customListenPosition;
2795 glm::quat _customListenOrientation;
2797 AtRestDetector _leftHandAtRestDetector;
2798 AtRestDetector _rightHandAtRestDetector;
2801 std::map<controller::Action, controller::Pose> _controllerPoseMap;
2802 mutable std::mutex _controllerPoseMapMutex;
2803 mutable std::mutex _disableHandTouchMutex;
2805 bool _centerOfGravityModelEnabled {
true };
2806 bool _hmdLeanRecenterEnabled {
true };
2807 bool _hmdCrouchRecenterEnabled {
2810 bool _sprint {
false };
2812 AnimPose _prePhysicsRoomPose;
2813 std::mutex _holdActionsMutex;
2814 std::vector<AvatarActionHold*> _holdActions;
2816 float MAX_AVATAR_MOVEMENT_PER_FRAME { 30.0f };
2817 glm::vec3 priorVelocity;
2818 glm::vec3 lastPosition;
2820 bool getIsAway()
const {
return _isAway; }
2821 void setAway(
bool value);
2822 void sendPacket(
const QUuid& entityID)
const override;
2824 std::mutex _pinnedJointsMutex;
2825 std::vector<int> _pinnedJoints;
2827 void updateChildCauterization(SpatiallyNestablePointer
object,
bool cauterize);
2830 ThreadSafeValueCache<float> _userHeight { DEFAULT_AVATAR_HEIGHT };
2831 float _averageUserHeightSensorSpace { _userHeight.get() };
2832 bool _sitStandStateChange {
false };
2835 ThreadSafeValueCache<float> _defaultWalkSpeed { DESKTOP_AVATAR_DEFAULT_WALKING_SPEED };
2836 ThreadSafeValueCache<float> _defaultSprintSpeed { DESKTOP_AVATAR_DEFAULT_SPRINT_SPEED };
2837 ThreadSafeValueCache<float> _vrWalkSpeed { VR_AVATAR_DEFAULT_WALKING_SPEED };
2839 float _walkSpeedScalar { AVATAR_WALK_SPEED_SCALAR };
2840 bool _isInWalkingState {
false };
2841 ThreadSafeValueCache<bool> _isInSittingState {
false };
2842 ThreadSafeValueCache<MyAvatar::AllowAvatarStandingPreference> _allowAvatarStandingPreference{
2843 MyAvatar::AllowAvatarStandingPreference::Default
2845 ThreadSafeValueCache<MyAvatar::AllowAvatarLeaningPreference> _allowAvatarLeaningPreference{
2846 MyAvatar::AllowAvatarLeaningPreference::Default
2848 float _sitStandStateTimer { 0.0f };
2849 float _tippingPoint { _userHeight.get() };
2852 bool _shouldLoadScripts {
false };
2854 bool _haveReceivedHeightLimitsFromDomain {
false };
2855 int _disableHandTouchCount { 0 };
2856 bool _reloadAvatarEntityDataFromSettings {
true };
2858 TimePoint _nextTraitsSendWindow;
2882 std::vector<Setting::Handle<QUuid>> _avatarEntityIDSettings;
2883 std::vector<Setting::Handle<QByteArray>> _avatarEntityDataSettings;
2890 mutable AvatarEntityMap _cachedAvatarEntityBlobs;
2901 std::vector<EntityItemID> _entitiesToDelete;
2902 std::vector<EntityItemID> _entitiesToAdd;
2903 std::vector<EntityItemID> _entitiesToUpdate;
2908 std::vector<EntityItemID> _cachedAvatarEntityBlobsToDelete;
2909 std::vector<EntityItemID> _cachedAvatarEntityBlobsToAddOrUpdate;
2910 std::vector<EntityItemID> _cachedAvatarEntityBlobUpdatesToSkip;
2913 mutable std::set<EntityItemID> _staleCachedAvatarEntityBlobs;
2920 bool _needToSaveAvatarEntitySettings {
false };
2922 bool _reactionTriggers[NUM_AVATAR_TRIGGER_REACTIONS] {
false,
false };
2923 int _reactionEnabledRefCounts[NUM_AVATAR_BEGIN_END_REACTIONS] { 0, 0, 0 };
2925 mutable std::mutex _reactionLock;
2928 bool _endSitKeyPressComplete {
false };
2930 glm::vec3 _cameraEyesOffset;
2931 float _landingAfterJumpTime { 0.0f };
2933 QTimer _addAvatarEntitiesToTreeTimer;
2936 Q_DECLARE_METATYPE(MyAvatar::DriveKeys)
2939 bool audioListenModeFromScriptValue(
const ScriptValue&
object, AudioListenerMode& audioListenerMode);
2942 bool driveKeysFromScriptValue(
const ScriptValue&
object, MyAvatar::DriveKeys& driveKeys);
2944 bool isWearableEntity(
const EntityItemPointer& entity);
Abstract ID for editing model items. Used in EntityItem JS API.
Definition: EntityItemID.h:28
Provides a wrapper around script engine that does not have ScriptManager.
Definition: HelperScriptEngine.h:31
Provides an engine-independent interface for a scripting engine.
Definition: ScriptEngine.h:93
[ScriptInterface] Provides an engine-independent interface for QScriptValue
Definition: ScriptValue.h:40