//
// MyAvatar.h
// interface/src/avatar
//
// Created by Mark Peng on 8/16/13.
// Copyright 2012 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_MyAvatar_h
#define hifi_MyAvatar_h
#include For assignment client scripts, see {@link Avatar}. Deprecated: This property is deprecated and will be removed. Use avatar entities instead. Deprecated: This property is deprecated and will be removed. Use Logical keys that drive your avatar and camera. Specifies different avatar leaning and recentering behaviors. The internal inverse-kinematics system maintains a record of which joints are "locked". Sometimes it is useful to
* forget this history to prevent contorted joints, e.g., after finishing with an override animation. The avatar animation system includes a set of default animations along with rules for how those animations are blended
* together with procedural data (such as look at vectors, hand sensors etc.). Note: When using pre-built animation data, it's critical that the joint orientation of the source animation and target
* rig are equivalent, since the animation data applies absolute values onto the joints. If the orientations are different,
* the avatar will move in unpredictable ways. For more information about avatar joint orientation standards, see
* Avatar Standards.MyAvatar
API is used to manipulate the avatar.
* For example, you can customize the avatar's appearance, run custom avatar animations,
* change the avatar's position within the domain, or manage the avatar's collisions with the environment and other avatars.
*
* 0.005
and
* 1000.0
. When the scale value is fetched, it may temporarily be further limited by the domain's settings.
* @property {number} density - The density of the avatar in kg/m3. The density is used to work out its mass in
* the application of physics. Read-only.
* @property {Vec3} handPosition - A user-defined hand position, in world coordinates. The position moves with the avatar
* but is otherwise not used or changed by Interface.
* @property {number} bodyYaw - The left or right rotation about an axis running from the head to the feet of the avatar.
* Yaw is sometimes called "heading".
* @property {number} bodyPitch - The rotation about an axis running from shoulder to shoulder of the avatar. Pitch is
* sometimes called "elevation".
* @property {number} bodyRoll - The rotation about an axis running from the chest to the back of the avatar. Roll is
* sometimes called "bank".
* @property {Quat} orientation - The orientation of the avatar.
* @property {Quat} headOrientation - The orientation of the avatar's head.
* @property {number} headPitch - The rotation about an axis running from ear to ear of the avatar's head. Pitch is
* sometimes called "elevation".
* @property {number} headYaw - The rotation left or right about an axis running from the base to the crown of the avatar's
* head. Yaw is sometimes called "heading".
* @property {number} headRoll - The rotation about an axis running from the nose to the back of the avatar's head. Roll is
* sometimes called "bank".
* @property {Vec3} velocity - The current velocity of the avatar.
* @property {Vec3} angularVelocity - The current angular velocity of the avatar.
* @property {number} audioLoudness - The instantaneous loudness of the audio input that the avatar is injecting into the
* domain.
* @property {number} audioAverageLoudness - The rolling average loudness of the audio input that the avatar is injecting
* into the domain.
* @property {string} displayName - The avatar's display name.
* @property {string} sessionDisplayName - displayName's
sanitized and default version defined by the avatar
* mixer rather than Interface clients. The result is unique among all avatars present in the domain at the time.
* @property {boolean} lookAtSnappingEnabled=true - true
if the avatar's eyes snap to look at another avatar's
* eyes when the other avatar is in the line of sight and also has lookAtSnappingEnabled == true
.
* @property {string} skeletonModelURL - The avatar's FST file.
* @property {AttachmentData[]} attachmentData - Information on the avatar's attachments.
* position
for use by QML.
*
* @property {boolean} shouldRenderLocally=true - If true
then your avatar is rendered for you in Interface,
* otherwise it is not rendered for you (but it is still rendered for other users).
* @property {Vec3} motorVelocity=Vec3.ZERO - The target velocity of your avatar to be achieved by a scripted motor.
* @property {number} motorTimescale=1000000 - The timescale for the scripted motor to achieve the target
* motorVelocity
avatar velocity. Smaller values result in higher acceleration.
* @property {string} motorReferenceFrame="camera" - Reference frame of the motorVelocity
. Must be one of the
* following: "camera"
, "avatar"
, and "world"
.
* @property {string} motorMode="simple" - The Type of scripted motor behavior: "simple"
to use the
* motorTimescale
time scale; "dynamic"
to use character controller timescales.
* @property {string} collisionSoundURL="Body_Hits_Impact.wav" - The sound that's played when the avatar experiences a
* collision. It can be a mono or stereo 16-bit WAV file running at either 24kHz or 48kHz. The latter is down-sampled
* by the audio mixer, so all audio effectively plays back at a 24khz. 48kHz RAW files are also supported.
* @property {number} audioListenerMode=0 - Specifies the listening position when hearing spatialized audio. Must be one
* of the following property values:
* Myavatar.audioListenerModeHead
* Myavatar.audioListenerModeCamera
* Myavatar.audioListenerModeCustom
* @property {number} audioListenerModeHead=0 - The audio listening position is at the avatar's head. Read-only.
* @property {number} audioListenerModeCamera=1 - The audio listening position is at the camera. Read-only.
* @property {number} audioListenerModeCustom=2 - The audio listening position is at a the position specified by set by the
* customListenPosition
and customListenOrientation
property values. Read-only.
* @property {Vec3} customListenPosition=Vec3.ZERO - The listening position used when the audioListenerMode
* property value is audioListenerModeCustom
.
* @property {Quat} customListenOrientation=Quat.IDENTITY - The listening orientation used when the
* audioListenerMode
property value is audioListenerModeCustom
.
* @property {boolean} hasScriptedBlendshapes=false - true
to transmit blendshapes over the network.
* Note: Currently doesn't work. Use {@link MyAvatar.setForceFaceTrackerConnected} instead.
* @property {boolean} hasProceduralBlinkFaceMovement=true - true
if procedural blinking is turned on.
* @property {boolean} hasProceduralEyeFaceMovement=true - true
if procedural eye movement is turned on.
* @property {boolean} hasAudioEnabledFaceMovement=true - true
to move the mouth blendshapes with voice audio
* when MyAvatar.hasScriptedBlendshapes
is enabled.
* @property {number} rotationRecenterFilterLength - Configures how quickly the avatar root rotates to recenter its facing
* direction to match that of the user's torso based on head and hands orientation. A smaller value makes the
* recentering happen more quickly. The minimum value is 0.01
.
* @property {number} rotationThreshold - The angle in radians that the user's torso facing direction (based on head and
* hands orientation) can differ from that of the avatar before the avatar's root is rotated to match the user's torso.
* @property {boolean} enableStepResetRotation - If true
then after the user's avatar takes a step, the
* avatar's root immediately rotates to recenter its facing direction to match that of the user's torso based on head
* and hands orientation.
* @property {boolean} enableDrawAverageFacing - If true
, debug graphics are drawn that show the average
* facing direction of the user's torso (based on head and hands orientation). This can be useful if you want to try
* out different filter lengths and thresholds.
*
* @property {Vec3} leftHandPosition - The position of the left hand in avatar coordinates if it's being positioned by
* controllers, otherwise {@link Vec3(0)|Vec3.ZERO}. Read-only.
* @property {Vec3} rightHandPosition - The position of the right hand in avatar coordinates if it's being positioned by
* controllers, otherwise {@link Vec3(0)|Vec3.ZERO}. Read-only.
* @property {Vec3} leftHandTipPosition - The position 0.3m in front of the left hand's position, in the direction along the
* palm, in avatar coordinates. If the hand isn't being positioned by a controller, the value is
* {@link Vec3(0)|Vec3.ZERO}. Read-only.
* @property {Vec3} rightHandTipPosition - The position 0.3m in front of the right hand's position, in the direction along
* the palm, in avatar coordinates. If the hand isn't being positioned by a controller, the value is
* {@link Vec3(0)|Vec3.ZERO}. Read-only.
*
* @property {Pose} leftHandPose - The left hand's pose as determined by the hand controllers, relative to the avatar.
* Read-only.
* @property {Pose} rightHandPose - The right hand's pose as determined by the hand controllers, relative to the avatar.
* Read-only.
* @property {Pose} leftHandTipPose - The left hand's pose as determined by the hand controllers, relative to the avatar,
* with the position adjusted by 0.3m along the direction of the palm. Read-only.
* @property {Pose} rightHandTipPose - The right hand's pose as determined by the hand controllers, relative to the avatar,
* with the position adjusted by 0.3m along the direction of the palm. Read-only.
*
* @property {number} energy - Deprecated: This property will be removed.
* @property {boolean} isAway - true
if your avatar is away (i.e., inactive), false
if it is
* active.
*
* @property {boolean} centerOfGravityModelEnabled=true - true
if the avatar hips are placed according to
* the center of gravity model that balances the center of gravity over the base of support of the feet. Set the
* value to false
for default behavior where the hips are positioned under the head.
* @property {boolean} hmdLeanRecenterEnabled=true - true
IF the avatar is re-centered to be under the
* head's position. In room-scale VR, this behavior is what causes your avatar to follow your HMD as you walk around
* the room. Setting the value false
is useful if you want to pin the avatar to a fixed position.
* @property {boolean} collisionsEnabled - Set to true
to enable the avatar to collide with the environment,
* false
to disable collisions with the environment. May return true
even though the value
* was set false
because the zone may disallow collisionless avatars.
* @property {boolean} otherAvatarsCollisionsEnabled - Set to true
to enable the avatar to collide with other
* avatars, false
to disable collisions with other avatars.
* @property {boolean} characterControllerEnabled - Synonym of collisionsEnabled
.
* collisionsEnabled
* instead.
* Note: Setting the value has no effect unless Interface is restarted.
*
* @property {number} yawSpeed=75 - The mouse X sensitivity value in Settings > General. Read-only.
* @property {number} pitchSpeed=50 - The mouse Y sensitivity value in Settings > General. Read-only.
*
* @property {boolean} hmdRollControlEnabled=true - If true
, the roll angle of your HMD turns your avatar
* while flying.
* @property {number} hmdRollControlDeadZone=8 - The amount of HMD roll, in degrees, required before your avatar turns if
* hmdRollControlEnabled
is enabled.
* @property {number} hmdRollControlRate If MyAvatar.hmdRollControlEnabled
is true, this value determines the
* maximum turn rate of your avatar when rolling your HMD in degrees per second.
*
* @property {number} userHeight=1.75 - The height of the user in sensor space.
* @property {number} userEyeHeight=1.65 - The estimated height of the user's eyes in sensor space. Read-only.
*
* @property {Uuid} SELF_ID - UUID representing "my avatar". Only use for local-only entities in situations
* where MyAvatar.sessionUUID is not available (e.g., if not connected to a domain). Note: Likely to be deprecated.
* Read-only.
*
* @property {number} walkSpeed - The walk speed of your avatar.
* @property {number} walkBackwardSpeed - The walk backward speed of your avatar.
* @property {number} sprintSpeed - The sprint speed of your avatar.
* @property {MyAvatar.SitStandModelType} userRecenterModel - Controls avatar leaning and recentering behavior.
* @property {number} isInSittingState - true
if your avatar is sitting (avatar leaning is disabled,
* recenntering is enabled), false
if it is standing (avatar leaning is enabled, and avatar recenters if it
* leans too far). If userRecenterModel == 2
(i.e., auto) the property value automatically updates as the
* user sits or stands, unless isSitStandStateLocked == true
. Setting the property value overrides the
* current siting / standing state, which is updated when the user next sits or stands unless
* isSitStandStateLocked == true
.
* @property {boolean} isSitStandStateLocked - true
to lock the avatar sitting/standing state, i.e., use this
* to disable automatically changing state.
* @property {boolean} allowTeleporting - true
if teleporting is enabled in the Interface settings,
* false
if it isn't. Read-only.
*
* @borrows Avatar.getDomainMinScale as getDomainMinScale
* @borrows Avatar.getDomainMaxScale as getDomainMaxScale
* @borrows Avatar.getEyeHeight as getEyeHeight
* @borrows Avatar.getHeight as getHeight
* @borrows Avatar.setHandState as setHandState
* @borrows Avatar.getHandState as getHandState
* @borrows Avatar.setRawJointData as setRawJointData
* @borrows Avatar.setJointData as setJointData
* @borrows Avatar.setJointRotation as setJointRotation
* @borrows Avatar.setJointTranslation as setJointTranslation
* @borrows Avatar.clearJointData as clearJointData
* @borrows Avatar.isJointDataValid as isJointDataValid
* @borrows Avatar.getJointRotation as getJointRotation
* @borrows Avatar.getJointTranslation as getJointTranslation
* @borrows Avatar.getJointRotations as getJointRotations
* @borrows Avatar.getJointTranslations as getJointTranslations
* @borrows Avatar.setJointRotations as setJointRotations
* @borrows Avatar.setJointTranslations as setJointTranslations
* @borrows Avatar.clearJointsData as clearJointsData
* @borrows Avatar.getJointIndex as getJointIndex
* @borrows Avatar.getJointNames as getJointNames
* @borrows Avatar.setBlendshape as setBlendshape
* @borrows Avatar.getAttachmentsVariant as getAttachmentsVariant
* @borrows Avatar.setAttachmentsVariant as setAttachmentsVariant
* @borrows Avatar.updateAvatarEntity as updateAvatarEntity
* @borrows Avatar.clearAvatarEntity as clearAvatarEntity
* @borrows Avatar.setForceFaceTrackerConnected as setForceFaceTrackerConnected
* @borrows Avatar.getAttachmentData as getAttachmentData
* @borrows Avatar.setAttachmentData as setAttachmentData
* @borrows Avatar.attach as attach
* @borrows Avatar.detachOne as detachOne
* @borrows Avatar.detachAll as detachAll
* @comment Avatar.getAvatarEntityData as getAvatarEntityData - Don't borrow because implementation is different.
* @comment Avatar.setAvatarEntityData as setAvatarEntityData - Don't borrow because implementation is different.
* @borrows Avatar.getSensorToWorldMatrix as getSensorToWorldMatrix
* @borrows Avatar.getSensorToWorldScale as getSensorToWorldScale
* @borrows Avatar.getControllerLeftHandMatrix as getControllerLeftHandMatrix
* @borrows Avatar.getControllerRightHandMatrix as getControllerRightHandMatrix
* @borrows Avatar.getDataRate as getDataRate
* @borrows Avatar.getUpdateRate as getUpdateRate
* @borrows Avatar.displayNameChanged as displayNameChanged
* @borrows Avatar.sessionDisplayNameChanged as sessionDisplayNameChanged
* @borrows Avatar.skeletonModelURLChanged as skeletonModelURLChanged
* @borrows Avatar.lookAtSnappingChanged as lookAtSnappingChanged
* @borrows Avatar.sessionUUIDChanged as sessionUUIDChanged
* @borrows Avatar.sendAvatarDataPacket as sendAvatarDataPacket
* @borrows Avatar.sendIdentityPacket as sendIdentityPacket
* @borrows Avatar.setSessionUUID as setSessionUUID
* @comment Avatar.getAbsoluteJointRotationInObjectFrame as getAbsoluteJointRotationInObjectFrame - Don't borrow because implementation is different.
* @comment Avatar.getAbsoluteJointTranslationInObjectFrame as getAbsoluteJointTranslationInObjectFrame - Don't borrow because implementation is different.
* @comment Avatar.setAbsoluteJointRotationInObjectFrame as setAbsoluteJointRotationInObjectFrame - Don't borrow because implementation is different.
* @comment Avatar.setAbsoluteJointTranslationInObjectFrame as setAbsoluteJointTranslationInObjectFrame - Don't borrow because implementation is different.
* @borrows Avatar.getTargetScale as getTargetScale
* @borrows Avatar.resetLastSent as resetLastSent
* @borrows Avatar.hasPriority as hasPriority
*/
// FIXME: `glm::vec3 position` is not accessible from QML, so this exposes position in a QML-native type
Q_PROPERTY(QVector3D qmlPosition READ getQmlPosition)
QVector3D getQmlPosition() { auto p = getWorldPosition(); return QVector3D(p.x, p.y, p.z); }
Q_PROPERTY(bool shouldRenderLocally READ getShouldRenderLocally WRITE setShouldRenderLocally)
Q_PROPERTY(glm::vec3 motorVelocity READ getScriptedMotorVelocity WRITE setScriptedMotorVelocity)
Q_PROPERTY(float motorTimescale READ getScriptedMotorTimescale WRITE setScriptedMotorTimescale)
Q_PROPERTY(QString motorReferenceFrame READ getScriptedMotorFrame WRITE setScriptedMotorFrame)
Q_PROPERTY(QString motorMode READ getScriptedMotorMode WRITE setScriptedMotorMode)
Q_PROPERTY(QString collisionSoundURL READ getCollisionSoundURL WRITE setCollisionSoundURL)
Q_PROPERTY(AudioListenerMode audioListenerMode READ getAudioListenerMode WRITE setAudioListenerMode)
Q_PROPERTY(AudioListenerMode audioListenerModeHead READ getAudioListenerModeHead)
Q_PROPERTY(AudioListenerMode audioListenerModeCamera READ getAudioListenerModeCamera)
Q_PROPERTY(AudioListenerMode audioListenerModeCustom READ getAudioListenerModeCustom)
Q_PROPERTY(glm::vec3 customListenPosition READ getCustomListenPosition WRITE setCustomListenPosition)
Q_PROPERTY(glm::quat customListenOrientation READ getCustomListenOrientation WRITE setCustomListenOrientation)
Q_PROPERTY(bool hasScriptedBlendshapes READ getHasScriptedBlendshapes WRITE setHasScriptedBlendshapes)
Q_PROPERTY(bool hasProceduralBlinkFaceMovement READ getHasProceduralBlinkFaceMovement WRITE setHasProceduralBlinkFaceMovement)
Q_PROPERTY(bool hasProceduralEyeFaceMovement READ getHasProceduralEyeFaceMovement WRITE setHasProceduralEyeFaceMovement)
Q_PROPERTY(bool hasAudioEnabledFaceMovement READ getHasAudioEnabledFaceMovement WRITE setHasAudioEnabledFaceMovement)
Q_PROPERTY(float rotationRecenterFilterLength READ getRotationRecenterFilterLength WRITE setRotationRecenterFilterLength)
Q_PROPERTY(float rotationThreshold READ getRotationThreshold WRITE setRotationThreshold)
Q_PROPERTY(bool enableStepResetRotation READ getEnableStepResetRotation WRITE setEnableStepResetRotation)
Q_PROPERTY(bool enableDrawAverageFacing READ getEnableDrawAverageFacing WRITE setEnableDrawAverageFacing)
//TODO: make gravity feature work Q_PROPERTY(glm::vec3 gravity READ getGravity WRITE setGravity)
Q_PROPERTY(glm::vec3 leftHandPosition READ getLeftHandPosition)
Q_PROPERTY(glm::vec3 rightHandPosition READ getRightHandPosition)
Q_PROPERTY(glm::vec3 leftHandTipPosition READ getLeftHandTipPosition)
Q_PROPERTY(glm::vec3 rightHandTipPosition READ getRightHandTipPosition)
Q_PROPERTY(controller::Pose leftHandPose READ getLeftHandPose)
Q_PROPERTY(controller::Pose rightHandPose READ getRightHandPose)
Q_PROPERTY(controller::Pose leftHandTipPose READ getLeftHandTipPose)
Q_PROPERTY(controller::Pose rightHandTipPose READ getRightHandTipPose)
Q_PROPERTY(float energy READ getEnergy WRITE setEnergy)
Q_PROPERTY(bool isAway READ getIsAway WRITE setAway)
Q_PROPERTY(bool centerOfGravityModelEnabled READ getCenterOfGravityModelEnabled WRITE setCenterOfGravityModelEnabled)
Q_PROPERTY(bool hmdLeanRecenterEnabled READ getHMDLeanRecenterEnabled WRITE setHMDLeanRecenterEnabled)
Q_PROPERTY(bool collisionsEnabled READ getCollisionsEnabled WRITE setCollisionsEnabled)
Q_PROPERTY(bool otherAvatarsCollisionsEnabled READ getOtherAvatarsCollisionsEnabled WRITE setOtherAvatarsCollisionsEnabled)
Q_PROPERTY(bool characterControllerEnabled READ getCharacterControllerEnabled WRITE setCharacterControllerEnabled)
Q_PROPERTY(bool useAdvancedMovementControls READ useAdvancedMovementControls WRITE setUseAdvancedMovementControls)
Q_PROPERTY(bool showPlayArea READ getShowPlayArea WRITE setShowPlayArea)
Q_PROPERTY(float yawSpeed MEMBER _yawSpeed)
Q_PROPERTY(float pitchSpeed MEMBER _pitchSpeed)
Q_PROPERTY(bool hmdRollControlEnabled READ getHMDRollControlEnabled WRITE setHMDRollControlEnabled)
Q_PROPERTY(float hmdRollControlDeadZone READ getHMDRollControlDeadZone WRITE setHMDRollControlDeadZone)
Q_PROPERTY(float hmdRollControlRate READ getHMDRollControlRate WRITE setHMDRollControlRate)
Q_PROPERTY(float userHeight READ getUserHeight WRITE setUserHeight)
Q_PROPERTY(float userEyeHeight READ getUserEyeHeight)
Q_PROPERTY(QUuid SELF_ID READ getSelfID CONSTANT)
Q_PROPERTY(float walkSpeed READ getWalkSpeed WRITE setWalkSpeed);
Q_PROPERTY(float walkBackwardSpeed READ getWalkBackwardSpeed WRITE setWalkBackwardSpeed);
Q_PROPERTY(float sprintSpeed READ getSprintSpeed WRITE setSprintSpeed);
Q_PROPERTY(bool isInSittingState READ getIsInSittingState WRITE setIsInSittingState);
Q_PROPERTY(MyAvatar::SitStandModelType userRecenterModel READ getUserRecenterModel WRITE setUserRecenterModel);
Q_PROPERTY(bool isSitStandStateLocked READ getIsSitStandStateLocked WRITE setIsSitStandStateLocked);
Q_PROPERTY(bool allowTeleporting READ getAllowTeleporting)
const QString DOMINANT_LEFT_HAND = "left";
const QString DOMINANT_RIGHT_HAND = "right";
const QString DEFAULT_HMD_AVATAR_ALIGNMENT_TYPE = "head";
using Clock = std::chrono::system_clock;
using TimePoint = Clock::time_point;
const float DEFAULT_GEAR_1 = 0.2f;
const float DEFAULT_GEAR_2 = 0.4f;
const float DEFAULT_GEAR_3 = 0.8f;
const float DEFAULT_GEAR_4 = 0.9f;
const float DEFAULT_GEAR_5 = 1.0f;
const bool DEFAULT_STRAFE_ENABLED = true;
public:
/**jsdoc
*
*
*
* @typedef {number} MyAvatar.DriveKeys
*/
enum DriveKeys {
TRANSLATE_X = 0,
TRANSLATE_Y,
TRANSLATE_Z,
YAW,
STEP_TRANSLATE_X,
STEP_TRANSLATE_Y,
STEP_TRANSLATE_Z,
STEP_YAW,
PITCH,
ZOOM,
DELTA_YAW,
DELTA_PITCH,
MAX_DRIVE_KEYS
};
Q_ENUM(DriveKeys)
/**jsdoc
*
*
*
* Value Name Description
* 0
TRANSLATE_X Move the user's avatar in the direction of its x-axis, if the
* camera isn't in independent or mirror modes.
* 1
TRANSLATE_Y Move the user's avatar in the direction of its y-axis, if the
* camera isn't in independent or mirror modes.
* 2
TRANSLATE_Z Move the user's avatar in the direction of its z-axis, if the
* camera isn't in independent or mirror modes
* 3
YAW Rotate the user's avatar about its y-axis at a rate proportional to the
* control value, if the camera isn't in independent or mirror modes.
* 4
STEP_TRANSLATE_X No action.
* 5
STEP_TRANSLATE_Y No action.
* 6
STEP_TRANSLATE_Z No action.
* 7
STEP_YAW Rotate the user's avatar about its y-axis in a step increment, if
* the camera isn't in independent or mirror modes.
* 8
PITCH Rotate the user's avatar head and attached camera about its negative
* x-axis (i.e., positive values pitch down) at a rate proportional to the control value, if the camera isn't in HMD,
* independent, or mirror modes.
* 9
ZOOM Zoom the camera in or out.
* 10
DELTA_YAW Rotate the user's avatar about its y-axis by an amount proportional
* to the control value, if the camera isn't in independent or mirror modes.
*
* 11
DELTA_PITCH Rotate the user's avatar head and attached camera about its
* negative x-axis (i.e., positive values pitch down) by an amount proportional to the control value, if the camera
* isn't in HMD, independent, or mirror modes.
*
*
* @typedef {number} MyAvatar.SitStandModelType
*/
enum SitStandModelType {
ForceSit = 0,
ForceStand,
Auto,
DisableHMDLean,
NumSitStandTypes
};
Q_ENUM(SitStandModelType)
explicit MyAvatar(QThread* thread);
virtual ~MyAvatar();
void instantiableAvatar() override {};
void registerMetaTypes(ScriptEnginePointer engine);
virtual void simulateAttachments(float deltaTime) override;
AudioListenerMode getAudioListenerModeHead() const { return FROM_HEAD; }
AudioListenerMode getAudioListenerModeCamera() const { return FROM_CAMERA; }
AudioListenerMode getAudioListenerModeCustom() const { return CUSTOM; }
void reset(bool andRecenter = false, bool andReload = true, bool andHead = true);
void setCollisionWithOtherAvatarsFlags() override;
/**jsdoc
* Resets the sensor positioning of your HMD (if in use) and recenters your avatar body and head.
* @function MyAvatar.resetSensorsAndBody
*/
Q_INVOKABLE void resetSensorsAndBody();
/**jsdoc
* Moves and orients the avatar, such that it is directly underneath the HMD, with toes pointed forward in the direction of
* the HMD.
* @function MyAvatar.centerBody
*/
Q_INVOKABLE void centerBody(); // thread-safe
/**jsdoc
* Clears inverse kinematics joint limit history.
*
*
*
* Value Name Description
* 0
ForceSit Assumes the user is seated in the real world. Disables avatar
* leaning regardless of what the avatar is doing in the virtual world (i.e., avatar always recenters).
* 1
ForceStand Assumes the user is standing in the real world. Enables avatar
* leaning regardless of what the avatar is doing in the virtual world (i.e. avatar leans, then if leans too far it
* recenters).
* 2
Auto Interface detects when the user is standing or seated in the real world.
* Avatar leaning is disabled when the user is sitting (i.e., avatar always recenters), and avatar leaning is enabled
* when the user is standing (i.e., avatar leans, then if leans too far it recenters).
*
* 3
DisableHMDLean Both avatar leaning and recentering are disabled regardless of
* what the user is doing in the real world and no matter what their avatar is doing in the virtual world. Enables
* the avatar to sit on the floor when the user sits on the floor.
Note: Experimental.overrideAnimation()
is used to
* completely override all motion from the default animation system (including inverse kinematics for hand and head
* controllers) and play a set of specified animations. To end these animations and restore the default animations, use
* {@link MyAvatar.restoreAnimation}.overrideHandAnimation()
Gets the overrides the default hand poses that are triggered with controller buttons.
* use {@link MyAvatar.restoreHandAnimation}.
The avatar animation system includes a set of default animations along with rules for how those animations are blended
* together with procedural data (such as look at vectors, hand sensors etc.). Playing your own custom animations will
* override the default animations. restoreAnimation()
is used to restore all motion from the default
* animation system including inverse kinematics for hand and head controllers. If you aren't currently playing an override
* animation, this function has no effect.
The avatar animation system includes a set of default animations along with rules for how those animations are blended
* together with procedural data (such as look at vectors, hand sensors etc.). Playing your own custom animations will
* override the default animations. restoreHandAnimation()
is used to restore the default hand poses
* If you aren't currently playing an override hand
* animation, this function has no effect.
Each avatar has an avatar-animation.json file that defines which animations are used and how they are blended together
* with procedural data (such as look at vectors, hand sensors etc.). Each animation specified in the avatar-animation.json
* file is known as an animation role. Animation roles map to easily understandable actions that the avatar can perform,
* such as "idleStand"
, "idleTalk"
, or "walkFwd"
. getAnimationRoles()
* is used get the list of animation roles defined in the avatar-animation.json.
Each avatar has an avatar-animation.json file that defines a set of animation roles. Animation roles map to easily
* understandable actions that the avatar can perform, such as "idleStand"
, "idleTalk"
, or
* "walkFwd"
. To get the full list of roles, use {@ link MyAvatar.getAnimationRoles}.
* For each role, the avatar-animation.json defines when the animation is used, the animation clip (FBX) used, and how
* animations are blended together with procedural data (such as look at vectors, hand sensors etc.).
* overrideRoleAnimation()
is used to change the animation clip (FBX) associated with a specified animation
* role. To end the role animation and restore the default, use {@link MyAvatar.restoreRoleAnimation}.
Note: Hand roles only affect the hand. Other 'main' roles, like 'idleStand', 'idleTalk', 'takeoffStand' are full body.
*Note: When using pre-built animation data, it's critical that the joint orientation of the source animation and target * rig are equivalent, since the animation data applies absolute values onto the joints. If the orientations are different, * the avatar will move in unpredictable ways. For more information about avatar joint orientation standards, see * Avatar Standards. * @function MyAvatar.overrideRoleAnimation * @param role {string} The animation role to override * @param url {string} The URL to the animation file. Animation files need to be in FBX format, but only need to contain the avatar skeleton and animation data. * @param fps {number} The frames per second (FPS) rate for the animation playback. 30 FPS is normal speed. * @param loop {boolean} Set to true if the animation should loop * @param firstFrame {number} The frame the animation should start at * @param lastFrame {number} The frame the animation should end at * @example
Each avatar has an avatar-animation.json file that defines a set of animation roles. Animation roles map to easily
* understandable actions that the avatar can perform, such as "idleStand"
, "idleTalk"
, or
* "walkFwd"
. To get the full list of roles, use {@link MyAvatar.getAnimationRoles}. For each role,
* the avatar-animation.json defines when the animation is used, the animation clip (FBX) used, and how animations are
* blended together with procedural data (such as look-at vectors, hand sensors etc.). You can change the animation clip
* (FBX) associated with a specified animation role using {@link MyAvatar.overrideRoleAnimation}.
* restoreRoleAnimation()
is used to restore a specified animation role's default animation clip. If you have
* not specified an override animation for the specified role, this function has no effect.
* @function MyAvatar.restoreRoleAnimation
* @param role {string} The animation role clip to restore.
*/
Q_INVOKABLE void restoreRoleAnimation(const QString& role);
// Adds handler(animStateDictionaryIn) => animStateDictionaryOut, which will be invoked just before each animGraph state update.
// The handler will be called with an animStateDictionaryIn that has all those properties specified by the (possibly empty)
// propertiesList argument. However for debugging, if the properties argument is null, all internal animGraph state is provided.
// The animStateDictionaryOut can be a different object than animStateDictionaryIn. Any properties set in animStateDictionaryOut
// will override those of the internal animation machinery.
// The animStateDictionaryIn may be shared among multiple handlers, and thus may contain additional properties specified when
// adding one of the other handlers. While any handler may change a value in animStateDictionaryIn (or supply different values in animStateDictionaryOut)
// a handler must not remove properties from animStateDictionaryIn, nor change property values that it does not intend to change.
// It is not specified in what order multiple handlers are called.
/**jsdoc
* Adds an animation state handler function that is invoked just before each animation graph update. More than one
* animation state handler function may be added by calling addAnimationStateHandler
multiple times. It is not
* specified in what order multiple handlers are called.
*
The animation state handler function is called with an {@link MyAvatar.AnimStateDictionary|AnimStateDictionary}
* "animStateDictionaryIn
" parameter and is expected to return an
* {@link MyAvatar.AnimStateDictionary|AnimStateDictionary} "animStateDictionaryOut
" object. The
* animStateDictionaryOut
object can be the same object as animStateDictionaryIn
, or it can be a
* different object. The animStateDictionaryIn
may be shared among multiple handlers and thus may contain
* additional properties specified when adding the different handlers.
A handler may change a value from animStateDictionaryIn
or add different values in the
* animStateDictionaryOut
returned. Any property values set in animStateDictionaryOut
will
* override those of the internal animation machinery.|null} propertiesList - The list of {@link MyAvatar.AnimStateDictionary|AnimStateDictionary}
* properties that should be included in the parameter that the handler function is called with. If null
* then all properties are included in the call parameter.
* @returns {number} The ID of the animation state handler function if successfully added, undefined
if not.
* @example
true
if you do snap turns in HMD mode; false
if you do smooth turns in HMD
* mode.
*/
Q_INVOKABLE bool getSnapTurn() const { return _useSnapTurn; }
/**jsdoc
* Sets whether your should do snap turns or smooth turns in HMD mode.
* @function MyAvatar.setSnapTurn
* @param {boolean} on - true
to do snap turns in HMD mode; false
to do smooth turns in HMD mode.
*/
Q_INVOKABLE void setSnapTurn(bool on) { _useSnapTurn = on; }
/**
* @function MyAvatar.getControlScheme
* @returns {number}
*/
Q_INVOKABLE int getControlScheme() const { return _controlSchemeIndex; }
/**
* @function MyAvatar.setControlScheme
* @param {number} index
*/
Q_INVOKABLE void setControlScheme(int index) { _controlSchemeIndex = (index >= 0 && index <= 2) ? index : 0; }
/**jsdoc
* Sets the avatar's dominant hand.
* @function MyAvatar.setDominantHand
* @param {string} hand - The dominant hand: "left"
for the left hand or "right"
for the right
* hand. Any other value has no effect.
*/
Q_INVOKABLE void setDominantHand(const QString& hand);
/**jsdoc
* Gets the avatar's dominant hand.
* @function MyAvatar.getDominantHand
* @returns {string} "left"
for the left hand, "right"
for the right hand.
*/
Q_INVOKABLE QString getDominantHand() const;
/**jsdoc
* @function MyAVatar.setStrafeEnabled
* @param {bool} enabled
*/
Q_INVOKABLE void setStrafeEnabled(bool enabled);
/**jsdoc
* @function MyAvatar.getStrafeEnabled
* @returns {bool}
*/
Q_INVOKABLE bool getStrafeEnabled() const;
/**jsdoc
* @function MyAvatar.setHmdAvatarAlignmentType
* @param {string} type - "head"
to align your head and your avatar's head, "eyes"
to align your
* eyes and your avatar's eyes.
*
*/
Q_INVOKABLE void setHmdAvatarAlignmentType(const QString& type);
/**jsdoc
* Gets the HMD alignment for your avatar.
* @function MyAvatar.getHmdAvatarAlignmentType
* @returns {string} "head"
if aligning your head and your avatar's head, "eyes"
if aligning your
* eyes and your avatar's eyes.
*/
Q_INVOKABLE QString getHmdAvatarAlignmentType() const;
/**jsdoc
* Sets whether the avatar's hips are balanced over the feet or positioned under the head.
* @function MyAvatar.setCenterOfGravityModelEnabled
* @param {boolean} enabled - true
to balance the hips over the feet, false
to position the hips
* under the head.
*/
Q_INVOKABLE void setCenterOfGravityModelEnabled(bool value) { _centerOfGravityModelEnabled = value; }
/**jsdoc
* Gets whether the avatar hips are being balanced over the feet or placed under the head.
* @function MyAvatar.getCenterOfGravityModelEnabled
* @returns {boolean} true
if the hips are being balanced over the feet, false
if the hips are
* being positioned under the head.
*/
Q_INVOKABLE bool getCenterOfGravityModelEnabled() const { return _centerOfGravityModelEnabled; }
/**jsdoc
* Sets whether the avatar's position updates to recenter the avatar under the head. In room-scale VR, recentering
* causes your avatar to follow your HMD as you walk around the room. Disabling recentering is useful if you want to pin
* the avatar to a fixed position.
* @function MyAvatar.setHMDLeanRecenterEnabled
* @param {boolean} enabled - true
to recenter the avatar under the head as it moves, false
to
* disable recentering.
*/
Q_INVOKABLE void setHMDLeanRecenterEnabled(bool value) { _hmdLeanRecenterEnabled = value; }
/**jsdoc
* Gets whether the avatar's position updates to recenter the avatar under the head. In room-scale VR, recentering
* causes your avatar to follow your HMD as you walk around the room.
* @function MyAvatar.getHMDLeanRecenterEnabled
* @returns {boolean} true
if recentering is enabled, false
if not.
*/
Q_INVOKABLE bool getHMDLeanRecenterEnabled() const { return _hmdLeanRecenterEnabled; }
/**jsdoc
* Requests that the hand touch effect is disabled for your avatar. Any resulting change in the status of the hand touch
* effect will be signaled by {@link MyAvatar.shouldDisableHandTouchChanged}.
* The hand touch effect makes the avatar's fingers adapt to the shape of any object grabbed, creating the effect that * it is really touching that object.
* @function MyAvatar.requestEnableHandTouch */ Q_INVOKABLE void requestEnableHandTouch(); /**jsdoc * Requests that the hand touch effect is enabled for your avatar. Any resulting change in the status of the hand touch * effect will be signaled by {@link MyAvatar.shouldDisableHandTouchChanged}. *The hand touch effect makes the avatar's fingers adapt to the shape of any object grabbed, creating the effect that * it is really touching that object.
* @function MyAvatar.requestDisableHandTouch */ Q_INVOKABLE void requestDisableHandTouch(); /**jsdoc * Disables the hand touch effect on a specific entity. *The hand touch effect makes the avatar's fingers adapt to the shape of any object grabbed, creating the effect that * it is really touching that object.
* @function MyAvatar.disableHandTouchForID * @param {Uuid} entityID - The entity that the hand touch effect will be disabled for. */ Q_INVOKABLE void disableHandTouchForID(const QUuid& entityID); /**jsdoc * Enables the hand touch effect on a specific entity. *The hand touch effect makes the avatar's fingers adapt to the shape of any object grabbed, creating the effect that * it is really touching that object.
* @function MyAvatar.enableHandTouchForID * @param {Uuid} entityID - The entity that the hand touch effect will be enabled for. */ Q_INVOKABLE void enableHandTouchForID(const QUuid& entityID); bool useAdvancedMovementControls() const { return _useAdvancedMovementControls.get(); } void setUseAdvancedMovementControls(bool useAdvancedMovementControls) { _useAdvancedMovementControls.set(useAdvancedMovementControls); } bool getAllowTeleporting() { return _allowTeleportingSetting.get(); } void setAllowTeleporting(bool allowTeleporting) { _allowTeleportingSetting.set(allowTeleporting); } bool getShowPlayArea() const { return _showPlayArea.get(); } void setShowPlayArea(bool showPlayArea) { _showPlayArea.set(showPlayArea); } void setHMDRollControlEnabled(bool value) { _hmdRollControlEnabled = value; } bool getHMDRollControlEnabled() const { return _hmdRollControlEnabled; } void setHMDRollControlDeadZone(float value) { _hmdRollControlDeadZone = value; } float getHMDRollControlDeadZone() const { return _hmdRollControlDeadZone; } void setHMDRollControlRate(float value) { _hmdRollControlRate = value; } float getHMDRollControlRate() const { return _hmdRollControlRate; } // get/set avatar data void resizeAvatarEntitySettingHandles(uint32_t maxIndex); void saveData(); void saveAvatarEntityDataToSettings(); void loadData(); void loadAvatarEntityDataFromSettings(); void saveAttachmentData(const AttachmentData& attachment) const; AttachmentData loadAttachmentData(const QUrl& modelURL, const QString& jointName = QString()) const; // Set what driving keys are being pressed to control thrust levels void clearDriveKeys(); void setDriveKey(DriveKeys key, float val); void setSprintMode(bool sprint); float getDriveKey(DriveKeys key) const; /**jsdoc * Gets the value of a drive key, regardless of whether it is disabled. * @function MyAvatar.getRawDriveKey * @param {MyAvatar.DriveKeys} key - The drive key. * @returns {number} The value of the drive key. */ Q_INVOKABLE float getRawDriveKey(DriveKeys key) const; void relayDriveKeysToCharacterController(); /**jsdoc * Disables the action associated with a drive key. * @function MyAvatar.disableDriveKey * @param {MyAvatar.DriveKeys} key - The drive key to disable. * @exampletrue
if the drive key is disabled, false
if it isn't.
*/
Q_INVOKABLE bool isDriveKeyDisabled(DriveKeys key) const;
/**jsdoc
* Recenter the avatar in the vertical direction, if {@link MyAvatar|MyAvatar.hmdLeanRecenterEnabled}
is
* false
.
* @function MyAvatar.triggerVerticalRecenter
*/
Q_INVOKABLE void triggerVerticalRecenter();
/**jsdoc
* Recenter the avatar in the horizontal direction, if {@link MyAvatar|MyAvatar.hmdLeanRecenterEnabled}
is
* false
.
* @function MyAvatar.triggerHorizontalRecenter
*/
Q_INVOKABLE void triggerHorizontalRecenter();
/**jsdoc
* Recenter the avatar's rotation, if {@link MyAvatar|MyAvatar.hmdLeanRecenterEnabled}
is false
.
* @function MyAvatar.triggerRotationRecenter
*/
Q_INVOKABLE void triggerRotationRecenter();
/**jsdoc
* Gets whether the avatar is configured to keep its center of gravity under its head.
* @function MyAvatar.isRecenteringHorizontally
* @returns {boolean} true
if the avatar is keeping its center of gravity under its head position,
* false
if not.
*/
Q_INVOKABLE bool isRecenteringHorizontally() const;
eyeContactTarget getEyeContactTarget();
const MyHead* getMyHead() const;
/**jsdoc
* Gets the current position of the avatar's "Head" joint.
* @function MyAvatar.getHeadPosition
* @returns {Vec3} The current position of the avatar's "Head" joint.
* @example 0
, in degrees.
*/
Q_INVOKABLE float getHeadDeltaPitch() const { return getHead()->getDeltaPitch(); }
/**jsdoc
* Gets the current position of the point directly between the avatar's eyes.
* @function MyAvatar.getEyePosition
* @returns {Vec3} The current position of the point directly between the avatar's eyes.
* @example Note: The Leap Motion isn't part of the hand controller input system. (Instead, it manipulates the avatar's joints * for hand animation.)
* @function MyAvatar.getLeftHandPosition * @returns {Vec3} The position of the left hand in avatar coordinates if positioned by a hand controller, otherwise *{@link Vec3(0)|Vec3.ZERO}
.
* @example Note: The Leap Motion isn't part of the hand controller input system. (Instead, it manipulates the avatar's joints * for hand animation.)
* @function MyAvatar.getRightHandPosition * @returns {Vec3} The position of the right hand in avatar coordinates if positioned by a hand controller, otherwise *{@link Vec3(0)|Vec3.ZERO}
.
* @example {@link Vec3(0)|Vec3.ZERO}
is returned.
*/
Q_INVOKABLE glm::vec3 getLeftHandTipPosition() const;
/**jsdoc
* Gets the position 0.3m in front of the right hand's position in the direction along the palm, in avatar coordinates, as
* positioned by a hand controller.
* @function MyAvatar.getRightHandTipPosition
* @returns {Vec3} The position 0.3m in front of the right hand's position in the direction along the palm, in avatar
* coordinates. If the hand isn't being positioned by a controller, {@link Vec3(0)|Vec3.ZERO}
is returned.
*/
Q_INVOKABLE glm::vec3 getRightHandTipPosition() const;
/**jsdoc
* Gets the pose (position, rotation, velocity, and angular velocity) of the avatar's left hand as positioned by a
* hand controller (e.g., Oculus Touch or Vive).
* Note: The Leap Motion isn't part of the hand controller input system. (Instead, it manipulates the avatar's joints
* for hand animation.) If you are using the Leap Motion, the return value's valid
property will be
* false
and any pose values returned will not be meaningful.
Note: The Leap Motion isn't part of the hand controller input system. (Instead, it manipulates the avatar's joints
* for hand animation.) If you are using the Leap Motion, the return value's valid
property will be
* false
and any pose values returned will not be meaningful.
Note: Leap Motion isn't part of the hand controller input system. (Instead, it manipulates the avatar's joints
* for hand animation.) If you are using Leap Motion, the return value's valid
property will be
* false
and any pose values returned will not be meaningful.
Note: Leap Motion isn't part of the hand controller input system. (Instead, it manipulates the avatar's joints
* for hand animation.) If you are using Leap Motion, the return value's valid
property will be
* false
and any pose values returned will not be meaningful.
Note: Only works on the hips joint.
* @function MyAvatar.pinJoint * @param {number} index - The index of the joint. * @param {Vec3} position - The position of the joint in world coordinates. * @param {Quat} orientation - The orientation of the joint in world coordinates. * @returns {boolean}true
if the joint was pinned, false
if it wasn't.
*/
Q_INVOKABLE bool pinJoint(int index, const glm::vec3& position, const glm::quat& orientation);
bool isJointPinned(int index);
/**jsdoc
* Clears a lock on a joint's position and orientation, as set by {@link MyAvatar.pinJoint|pinJoint}.
* Note: Only works on the hips joint.
* @function MyAvatar.clearPinOnJoint * @param {number} index - The index of the joint. * @returns {boolean}true
if the joint was unpinned, false
if it wasn't.
*/
Q_INVOKABLE bool clearPinOnJoint(int index);
/**jsdoc
* Gets the maximum error distance from the most recent inverse kinematics (IK) solution.
* @function MyAvatar.getIKErrorOnLastSolve
* @returns {number} The maximum IK error distance.
*/
Q_INVOKABLE float getIKErrorOnLastSolve() const;
/**jsdoc
* Changes the user's avatar and associated descriptive name.
* @function MyAvatar.useFullAvatarURL
* @param {string} fullAvatarURL - The URL of the avatar's .fst
file.
* @param {string} [modelName=""] - Descriptive name of the avatar.
*/
Q_INVOKABLE void useFullAvatarURL(const QUrl& fullAvatarURL, const QString& modelName = QString());
/**jsdoc
* Gets the complete URL for the current avatar.
* @function MyAvatar.getFullAvatarURLFromPreferences
* @returns {string} The full avatar model name.
* @example true
if your avatar is flying and not taking off or falling, false
if not.
*/
Q_INVOKABLE bool isFlying();
/**jsdoc
* Checks whether your avatar is in the air.
* @function MyAvatar.isInAir
* @returns {boolean} true
if your avatar is taking off, flying, or falling, otherwise false
* because your avatar is on the ground.
*/
Q_INVOKABLE bool isInAir();
/**jsdoc
* Sets your preference for flying in your current desktop or HMD display mode. Note that your ability to fly also depends
* on whether the domain you're in allows you to fly.
* @function MyAvatar.setFlyingEnabled
* @param {boolean} enabled - Set true
if you want to enable flying in your current desktop or HMD display
* mode, otherwise set false
.
*/
Q_INVOKABLE void setFlyingEnabled(bool enabled);
/**jsdoc
* Gets your preference for flying in your current desktop or HMD display mode. Note that your ability to fly also depends
* on whether the domain you're in allows you to fly.
* @function MyAvatar.getFlyingEnabled
* @returns {boolean} true
if your preference is to enable flying in your current desktop or HMD display mode,
* otherwise false
.
*/
Q_INVOKABLE bool getFlyingEnabled();
/**jsdoc
* Sets your preference for flying in desktop display mode. Note that your ability to fly also depends on whether the domain
* you're in allows you to fly.
* @function MyAvatar.setFlyingDesktopPref
* @param {boolean} enabled - Set true
if you want to enable flying in desktop display mode, otherwise set
* false
.
*/
Q_INVOKABLE void setFlyingDesktopPref(bool enabled);
/**jsdoc
* Gets your preference for flying in desktop display mode. Note that your ability to fly also depends on whether the domain
* you're in allows you to fly.
* @function MyAvatar.getFlyingDesktopPref
* @returns {boolean} true
if your preference is to enable flying in desktop display mode, otherwise
* false
.
*/
Q_INVOKABLE bool getFlyingDesktopPref();
/**jsdoc
* Sets your preference for flying in HMD display mode. Note that your ability to fly also depends on whether the domain
* you're in allows you to fly.
* @function MyAvatar.setFlyingHMDPref
* @param {boolean} enabled - Set true
if you want to enable flying in HMD display mode, otherwise set
* false
.
*/
Q_INVOKABLE void setFlyingHMDPref(bool enabled);
/**jsdoc
* Gets your preference for flying in HMD display mode. Note that your ability to fly also depends on whether the domain
* you're in allows you to fly.
* @function MyAvatar.getFlyingHMDPref
* @returns {boolean} true
if your preference is to enable flying in HMD display mode, otherwise
* false
.
*/
Q_INVOKABLE bool getFlyingHMDPref();
/**jsdoc
* Set your preference for hand-relative movement.
* @function MyAvatar.setHandRelativeMovement
* @param {number} enabled - Set true
if you want to enable hand-relative movement, otherwise set to false
.
*
*/
Q_INVOKABLE void setMovementReference(int enabled);
/**jsdoc
* Get your preference for hand-relative movement.
* @function MyAvatar.getHandRelativeMovement
* @returns {number} true
if your preference is for user locomotion to be relative to the direction your
* controller is pointing, otherwise false
.
*/
Q_INVOKABLE int getMovementReference();
/**jsdoc
* Set the first 'shifting point' for acceleration step function.
* @function MyAvatar.setDriveGear1
* @param {number} shiftPoint - Set the first shift point for analog movement acceleration step function, between [0.0, 1.0]. Must be less than or equal to Gear 2.
*/
Q_INVOKABLE void setDriveGear1(float shiftPoint);
/**jsdoc
* Get the first 'shifting point' for acceleration step function.
* @function MyAvatar.getDriveGear1
* @returns {number} Value between [0.0, 1.0].
*/
Q_INVOKABLE float getDriveGear1();
/**jsdoc
* Set the second 'shifting point' for acceleration step function.
* @function MyAvatar.setDriveGear2
* @param {number} shiftPoint - Defines the second shift point for analog movement acceleration step function, between [0, 1]. Must be greater than or equal to Gear 1 and less than or equal to Gear 2.
*/
Q_INVOKABLE void setDriveGear2(float shiftPoint);
/**jsdoc
* Get the second 'shifting point' for acceleration step function.
* @function MyAvatar.getDriveGear2
* @returns {number} Value between [0.0, 1.0].
*/
Q_INVOKABLE float getDriveGear2();
/**jsdoc
* Set the third 'shifting point' for acceleration step function.
* @function MyAvatar.setDriveGear3
* @param {number} shiftPoint - Defines the third shift point for analog movement acceleration step function, between [0, 1]. Must be greater than or equal to Gear 2 and less than or equal to Gear 4.
*/
Q_INVOKABLE void setDriveGear3(float shiftPoint);
/**jsdoc
* Get the third 'shifting point' for acceleration step function.
* @function MyAvatar.getDriveGear3
* @returns {number} Value between [0.0, 1.0].
*/
Q_INVOKABLE float getDriveGear3();
/**jsdoc
* Set the fourth 'shifting point' for acceleration step function.
* @function MyAvatar.setDriveGear4
* @param {number} shiftPoint - Defines the fourth shift point for analog movement acceleration step function, between [0, 1]. Must be greater than Gear 3 and less than Gear 5.
*/
Q_INVOKABLE void setDriveGear4(float shiftPoint);
/**jsdoc
* Get the fourth 'shifting point' for acceleration step function.
* @function MyAvatar.getDriveGear4
* @returns {number} Value between [0.0, 1.0].
*/
Q_INVOKABLE float getDriveGear4();
/**jsdoc
* Set the fifth 'shifting point' for acceleration step function.
* @function MyAvatar.setDriveGear5
* @param {number} shiftPoint - Defines the fifth shift point for analog movement acceleration step function, between [0, 1]. Must be greater than or equal to Gear 4.
*/
Q_INVOKABLE void setDriveGear5(float shiftPoint);
/**jsdoc
* Get the fifth 'shifting point' for acceleration step function.
* @function MyAvatar.getDriveGear5
* @returns {number} Value between [0.0, 1.0].
*/
Q_INVOKABLE float getDriveGear5();
/**jsdoc
* Choose the control scheme.
* @function MyAvatar.setControlSchemeIndex
* @param {number} Choose the control scheme to be used.
*/
void setControlSchemeIndex(int index);
/**jsdoc
* Check what control scheme is in use.
* @function MyAvatar.getControlSchemeIndex
* @returns {number} Returns the index associated with a given control scheme.
*/
int getControlSchemeIndex();
/**jsdoc
* Gets the target scale of the avatar. The target scale is the desired scale of the avatar without any restrictions on
* permissible scale values imposed by the domain.
* @function MyAvatar.getAvatarScale
* @returns {number} The target scale for the avatar, range 0.005
– 1000.0
.
*/
Q_INVOKABLE float getAvatarScale();
/**jsdoc
* Sets the target scale of the avatar. The target scale is the desired scale of the avatar without any restrictions on
* permissible scale values imposed by the domain.
* @function MyAvatar.setAvatarScale
* @param {number} scale - The target scale for the avatar, range 0.005
– 1000.0
.
*/
Q_INVOKABLE void setAvatarScale(float scale);
/**jsdoc
* Sets whether the avatar should collide with entities.
* Note: A false
value won't disable collisions if the avatar is in a zone that disallows
* collisionless avatars. However, the false
value will be set so that collisions are disabled as soon as the
* avatar moves to a position where collisionless avatars are allowed.
* @function MyAvatar.setCollisionsEnabled
* @param {boolean} enabled - true
to enable the avatar to collide with entities, false
to
* disable.
*/
Q_INVOKABLE void setCollisionsEnabled(bool enabled);
/**jsdoc
* Gets whether the avatar will currently collide with entities.
*
Note: The avatar will always collide with entities if in a zone that disallows collisionless avatars.
* @function MyAvatar.getCollisionsEnabled
* @returns {boolean} true
if the avatar will currently collide with entities, false
if it won't.
*/
Q_INVOKABLE bool getCollisionsEnabled();
/**jsdoc
* Sets whether the avatar should collide with other avatars.
* @function MyAvatar.setOtherAvatarsCollisionsEnabled
* @param {boolean} enabled - true
to enable the avatar to collide with other avatars, false
* to disable.
*/
Q_INVOKABLE void setOtherAvatarsCollisionsEnabled(bool enabled);
/**jsdoc
* Gets whether the avatar will collide with other avatars.
* @function MyAvatar.getOtherAvatarsCollisionsEnabled
* @returns {boolean} true
if the avatar will collide with other avatars, false
if it won't.
*/
Q_INVOKABLE bool getOtherAvatarsCollisionsEnabled();
/**jsdoc
* Gets the avatar's collision capsule: a cylinder with hemispherical ends that approximates the extents or the avatar.
*
Warning: The values returned are in world coordinates but aren't necessarily up to date with the * avatar's current position.
* @function MyAvatar.getCollisionCapsule * @returns {MyAvatar.CollisionCapsule} The avatar's collision capsule. */ Q_INVOKABLE QVariantMap getCollisionCapsule() const; /**jsdoc * @function MyAvatar.setCharacterControllerEnabled * @param {boolean} enabled -true
to enable the avatar to collide with entities, false
to
* disable.
* @deprecated This function is deprecated and will be removed. Use {@link MyAvatar.setCollisionsEnabled} instead.
*/
Q_INVOKABLE void setCharacterControllerEnabled(bool enabled); // deprecated
/**jsdoc
* @function MyAvatar.getCharacterControllerEnabled
* @returns {boolean} true
if the avatar will currently collide with entities, false
if it won't.
* @deprecated This function is deprecated and will be removed. Use {@link MyAvatar.getCollisionsEnabled} instead.
*/
Q_INVOKABLE bool getCharacterControllerEnabled(); // deprecated
/**jsdoc
* @comment Different behavior to the Avatar version of this method.
* Gets the rotation of a joint relative to the avatar.
* @function MyAvatar.getAbsoluteJointRotationInObjectFrame
* @param {number} index - The index of the joint.
* @returns {Quat} The rotation of the joint relative to the avatar.
* @example > 0
).
* @function MyAvatar.isUp
* @param {Vec3} direction - The vector to test.
* @returns {boolean} true
if the direction vector is pointing generally in the direction of the avatar's "up"
* direction.
*/
Q_INVOKABLE bool isUp(const glm::vec3& direction) { return glm::dot(direction, _worldUpDirection) > 0.0f; }; // true iff direction points up wrt avatar's definition of up.
/**jsdoc
* Tests whether a vector is pointing in the general direction of the avatar's "down" direction (i.e., dot product of
* vectors is < 0
).
* @function MyAvatar.isDown
* @param {Vec3} direction - The vector to test.
* @returns {boolean} true
if the direction vector is pointing generally in the direction of the avatar's
* "down" direction.
*/
Q_INVOKABLE bool isDown(const glm::vec3& direction) { return glm::dot(direction, _worldUpDirection) < 0.0f; };
void setUserHeight(float value);
float getUserHeight() const;
float getUserEyeHeight() const;
virtual SpatialParentTree* getParentTree() const override;
virtual glm::vec3 scaleForChildren() const override { return glm::vec3(getSensorToWorldScale()); }
const QUuid& getSelfID() const { return AVATAR_SELF_ID; }
void setIsInWalkingState(bool isWalking);
bool getIsInWalkingState() const;
void setIsInSittingState(bool isSitting);
bool getIsInSittingState() const;
void setUserRecenterModel(MyAvatar::SitStandModelType modelName);
MyAvatar::SitStandModelType getUserRecenterModel() const;
void setIsSitStandStateLocked(bool isLocked);
bool getIsSitStandStateLocked() const;
void setWalkSpeed(float value);
float getWalkSpeed() const;
void setWalkBackwardSpeed(float value);
float getWalkBackwardSpeed() const;
void setSprintSpeed(float value);
float getSprintSpeed() const;
void setAnalogWalkSpeed(float value);
float getAnalogWalkSpeed() const;
void setAnalogSprintSpeed(float value);
float getAnalogSprintSpeed() const;
void setAnalogPlusWalkSpeed(float value);
float getAnalogPlusWalkSpeed() const;
void setAnalogPlusSprintSpeed(float value);
float getAnalogPlusSprintSpeed() const;
void setSitStandStateChange(bool stateChanged);
float getSitStandStateChange() const;
void updateSitStandState(float newHeightReading, float dt);
QVectortrue
if flow simulation is enabled on the joint, false
if it isn't.
* @param {boolean} isCollidable - true
to enable collisions in the flow simulation, false
to
* disable.
* @param {Object1000
.
* @function MyAvatar.increaseSize
* @example 0.25
.
* @function MyAvatar.decreaseSize
* @example 1.0
.
* @function MyAvatar.resetSize
*/
void resetSize();
/**jsdoc
* @function MyAvatar.animGraphLoaded
* @deprecated This function is deprecated and will be removed.
*/
void animGraphLoaded();
/**jsdoc
* Sets the amount of gravity applied to the avatar in the y-axis direction. (Negative values are downward.)
* @function MyAvatar.setGravity
* @param {number} gravity - The amount of gravity to be applied to the avatar, in m/s2.
*/
void setGravity(float gravity);
/**jsdoc
* Sets the amount of gravity applied to the avatar in the y-axis direction. (Negative values are downward.) The default
* value is -5
m/s2.
* @function MyAvatar.getGravity
* @returns {number} The amount of gravity currently applied to the avatar, in m/s2.
*/
float getGravity();
/**jsdoc
* Moves the avatar to a new position and/or orientation in the domain, while taking into account Avatar leg-length.
* @function MyAvatar.goToFeetLocation
* @param {Vec3} position - The new position for the avatar, in world coordinates.
* @param {boolean} [hasOrientation=false] - Set to true
to set the orientation of the avatar.
* @param {Quat} [orientation=Quat.IDENTITY] - The new orientation for the avatar.
* @param {boolean} [shouldFaceLocation=false] - Set to true
to position the avatar a short distance away from
* the new position and orientate the avatar to face the position.
*/
void goToFeetLocation(const glm::vec3& newPosition,
bool hasOrientation, const glm::quat& newOrientation,
bool shouldFaceLocation);
/**jsdoc
* Moves the avatar to a new position and/or orientation in the domain.
* @function MyAvatar.goToLocation
* @param {Vec3} position - The new position for the avatar, in world coordinates.
* @param {boolean} [hasOrientation=false] - Set to true
to set the orientation of the avatar.
* @param {Quat} [orientation=Quat.IDENTITY] - The new orientation for the avatar.
* @param {boolean} [shouldFaceLocation=false] - Set to true
to position the avatar a short distance away from
* @param {boolean} [withSafeLanding=true] - Set to false
MyAvatar::safeLanding will not be called (used when teleporting).
* the new position and orientate the avatar to face the position.
*/
void goToLocation(const glm::vec3& newPosition,
bool hasOrientation = false, const glm::quat& newOrientation = glm::quat(),
bool shouldFaceLocation = false, bool withSafeLanding = true);
/**jsdoc
* Moves the avatar to a new position and (optional) orientation in the domain.
* @function MyAvatar.goToLocation
* @param {MyAvatar.GoToProperties} target - The goto target.
*/
void goToLocation(const QVariant& properties);
/**jsdoc
* Moves the avatar to a new position and then enables collisions.
* @function MyAvatar.goToLocationAndEnableCollisions
* @param {Vec3} position - The new position for the avatar, in world coordinates.
*/
void goToLocationAndEnableCollisions(const glm::vec3& newPosition);
/**jsdoc
* @function MyAvatar.safeLanding
* @param {Vec3} position -The new position for the avatar, in world coordinates.
* @returns {boolean} true
if the avatar was moved, false
if it wasn't.
* @deprecated This function is deprecated and will be removed.
*/
bool safeLanding(const glm::vec3& position);
/**jsdoc
* @function MyAvatar.restrictScaleFromDomainSettings
* @param {object} domainSettings - Domain settings.
* @deprecated This function is deprecated and will be removed.
*/
void restrictScaleFromDomainSettings(const QJsonObject& domainSettingsObject);
/**jsdoc
* @function MyAvatar.clearScaleRestriction
* @deprecated This function is deprecated and will be removed.
*/
void clearScaleRestriction();
/**jsdoc
* Adds a thrust to your avatar's current thrust to be applied for a short while.
* @function MyAvatar.addThrust
* @param {Vec3} thrust - The thrust direction and magnitude.
* @deprecated This function is deprecated and will be removed. Use {@link MyAvatar|MyAvatar.motorVelocity} and related
* properties instead.
*/
// Set/Get update the thrust that will move the avatar around
void addThrust(glm::vec3 newThrust) { _thrust += newThrust; };
/**jsdoc
* Gets the thrust currently being applied to your avatar.
* @function MyAvatar.getThrust
* @returns {Vec3} The thrust currently being applied to your avatar.
* @deprecated This function is deprecated and will be removed. Use {@link MyAvatar|MyAvatar.motorVelocity} and related
* properties instead.
*/
glm::vec3 getThrust() { return _thrust; };
/**jsdoc
* Sets the thrust to be applied to your avatar for a short while.
* @function MyAvatar.setThrust
* @param {Vec3} thrust - The thrust direction and magnitude.
* @deprecated This function is deprecated and will be removed. Use {@link MyAvatar|MyAvatar.motorVelocity} and related
* properties instead.
*/
void setThrust(glm::vec3 newThrust) { _thrust = newThrust; }
/**jsdoc
* Updates avatar motion behavior from the Developer > Avatar > Enable Default Motor Control and Enable Scripted
* Motor Control menu items.
* @function MyAvatar.updateMotionBehaviorFromMenu
*/
Q_INVOKABLE void updateMotionBehaviorFromMenu();
/**jsdoc
* @function MyAvatar.setToggleHips
* @param {boolean} enabled - Enabled.
* @deprecated This function is deprecated and will be removed.
*/
void setToggleHips(bool followHead);
/**jsdoc
* Displays the base of support area debug graphics if in HMD mode. If your head goes outside this area your avatar's hips
* are moved to counterbalance your avatar, and if your head moves too far then your avatar's position is moved (i.e., a
* step happens).
* @function MyAvatar.setEnableDebugDrawBaseOfSupport
* @param {boolean} enabled - true
to show the debug graphics, false
to hide.
*/
void setEnableDebugDrawBaseOfSupport(bool isEnabled);
/**jsdoc
* Displays default pose debug graphics.
* @function MyAvatar.setEnableDebugDrawDefaultPose
* @param {boolean} enabled - true
to show the debug graphics, false
to hide.
*/
void setEnableDebugDrawDefaultPose(bool isEnabled);
/**jsdoc
* Displays animation debug graphics.
* @function MyAvatar.setEnableDebugDrawAnimPose
* @param {boolean} enabled - true
to show the debug graphics, false
to hide.
*/
void setEnableDebugDrawAnimPose(bool isEnabled);
/**jsdoc
* Displays position debug graphics.
* @function MyAvatar.setEnableDebugDrawPosition
* @param {boolean} enabled - true
to show the debug graphics, false
to hide.
*/
void setEnableDebugDrawPosition(bool isEnabled);
/**jsdoc
* Displays controller hand target debug graphics.
* @function MyAvatar.setEnableDebugDrawHandControllers
* @param {boolean} enabled - true
to show the debug graphics, false
to hide.
*/
void setEnableDebugDrawHandControllers(bool isEnabled);
/**jsdoc
* Displays sensor-to-world matrix debug graphics.
* @function MyAvatar.setEnableDebugDrawSensorToWorldMatrix
* @param {boolean} enable - true
to show the debug graphics, false
to hide.
*/
void setEnableDebugDrawSensorToWorldMatrix(bool isEnabled);
/**jsdoc
* Displays inverse kinematics targets debug graphics.
* @function MyAvatar.setEnableDebugDrawIKTargets
* @param {boolean} enabled - true
to show the debug graphics, false
to hide.
*/
void setEnableDebugDrawIKTargets(bool isEnabled);
/**jsdoc
* Displays inverse kinematics constraints debug graphics.
* @function MyAvatar.setEnableDebugDrawIKConstraints
* @param {boolean} enabled - true
to show the debug graphics, false
to hide.
*/
void setEnableDebugDrawIKConstraints(bool isEnabled);
/**jsdoc
* Displays inverse kinematics chains debug graphics.
* @function MyAvatar.setEnableDebugDrawIKChains
* @param {boolean} enabled - true
to show the debug graphics, false
to hide.
*/
void setEnableDebugDrawIKChains(bool isEnabled);
/**jsdoc
* Displays detailed collision debug graphics.
* @function MyAvatar.setEnableDebugDrawDetailedCollision
* @param {boolean} enabled - true
to show the debug graphics, false
to hide.
*/
void setEnableDebugDrawDetailedCollision(bool isEnabled);
/**jsdoc
* Gets whether your avatar mesh is visible.
* @function MyAvatar.getEnableMeshVisible
* @returns {boolean} true
if your avatar's mesh is visible, otherwise false
.
*/
bool getEnableMeshVisible() const override;
/**jsdoc
* @function MyAvatar.storeAvatarEntityDataPayload
* @deprecated This function is deprecated and will be removed.
*/
void storeAvatarEntityDataPayload(const QUuid& entityID, const QByteArray& payload) override;
/**jsdoc
* @comment Uses the base class's JSDoc.
*/
void clearAvatarEntity(const QUuid& entityID, bool requiresRemovalFromTree = true) override;
/**jsdoc
* @function MyAvatar.sanitizeAvatarEntityProperties
* @param {EntityItemProperties} properties - Properties.
* @deprecated This function is deprecated and will be removed.
*/
void sanitizeAvatarEntityProperties(EntityItemProperties& properties) const;
/**jsdoc
* Sets whether your avatar mesh is visible to you.
* @function MyAvatar.setEnableMeshVisible
* @param {boolean} enabled - true
to show your avatar mesh, false
to hide.
* @example true
to enable IK, false
to disable.
*/
void setEnableInverseKinematics(bool isEnabled);
/**jsdoc
* Gets the URL of the override animation graph.
* See {@link https://docs.highfidelity.com/create/avatars/custom-animations.html|Custom Avatar Animations} for * information on animation graphs.
* @function MyAvatar.getAnimGraphOverrideUrl * @returns {string} The URL of the override animation graph JSON file.""
if there is no override animation
* graph.
*/
QUrl getAnimGraphOverrideUrl() const; // thread-safe
/**jsdoc
* Sets the animation graph to use in preference to the default animation graph.
* See {@link https://docs.highfidelity.com/create/avatars/custom-animations.html|Custom Avatar Animations} for * information on animation graphs.
* @function MyAvatar.setAnimGraphOverrideUrl * @param {string} url - The URL of the animation graph JSON file to use. Set to""
to clear an override.
*/
void setAnimGraphOverrideUrl(QUrl value); // thread-safe
/**jsdoc
* Gets the URL of animation graph (i.e., the avatar animation JSON) that's currently being used for avatar animations.
* See {@link https://docs.highfidelity.com/create/avatars/custom-animations.html|Custom Avatar Animations} for * information on animation graphs.
* @function MyAvatar.getAnimGraphUrl * @returns {string} The URL of the current animation graph JSON file. * @ExampleSee {@link https://docs.highfidelity.com/create/avatars/custom-animations.html|Custom Avatar Animations} for * information on animation graphs.
* @function MyAvatar.setAnimGraphUrl * @param {string} url - The URL of the animation graph JSON file to use. */ void setAnimGraphUrl(const QUrl& url); // thread-safe /**jsdoc * Gets your listening position for spatialized audio. The position depends on the value of the * {@link Myavatar|audioListenerMode} property. * @function MyAvatar.getPositionForAudio * @returns {Vec3} Your listening position. */ glm::vec3 getPositionForAudio(); /**jsdoc * Gets the orientation of your listening position for spatialized audio. The orientation depends on the value of the * {@link Myavatar|audioListenerMode} property. * @function MyAvatar.getOrientationForAudio * @returns {Quat} The orientation of your listening position. */ glm::quat getOrientationForAudio(); /**jsdoc * @function MyAvatar.setModelScale * @param {number} scale - The scale. * @deprecated This function is deprecated and will be removed. */ virtual void setModelScale(float scale) override; signals: /**jsdoc * Triggered when the {@link MyAvatar|audioListenerMode} property value changes. * @function MyAvatar.audioListenerModeChanged * @returns {Signal} */ void audioListenerModeChanged(); /**jsdoc * @function MyAvatar.transformChanged * @returns {Signal} * @deprecated This signal is deprecated and will be removed. */ void transformChanged(); /**jsdoc * Triggered when the {@link MyAvatar|collisionSoundURL} property value changes. * @function MyAvatar.newCollisionSoundURL * @param {string} url - The URL of the new collision sound. * @returns {Signal} */ void newCollisionSoundURL(const QUrl& url); /**jsdoc * Triggered when the avatar collides with an entity. * @function MyAvatar.collisionWithEntity * @param {Collision} collision - Details of the collision. * @returns {Signal} * @exampletrue
if collisions with the environment are enabled, false
if
* they're not.
* @returns {Signal}
*/
void collisionsEnabledChanged(bool enabled);
/**jsdoc
* Triggered when collisions with other avatars are enabled or disabled.
* @function MyAvatar.otherAvatarsCollisionsEnabledChanged
* @param {boolean} enabled - true
if collisions with other avatars are enabled, false
if they're
* not.
* @returns {Signal}
*/
void otherAvatarsCollisionsEnabledChanged(bool enabled);
/**jsdoc
* Triggered when the avatar's animation graph being used changes.
* @function MyAvatar.animGraphUrlChanged
* @param {string} url - The URL of the new animation graph JSON file.
* @returns {Signal}
* @example Synonym of {@link MyAvatar.skeletonModelURLChanged|skeletonModelURLChanged}.
* @function MyAvatar.skeletonChanged * @returns {Signal} */ void skeletonChanged(); /**jsdoc * Triggered when the avatar's dominant hand changes. * @function MyAvatar.dominantHandChanged * @param {string} hand - The dominant hand:"left"
for the left hand, "right"
for the right hand.
* @returns {Signal}
*/
void dominantHandChanged(const QString& hand);
/**jsdoc
* Triggered when the HMD alignment for your avatar changes.
* @function MyAvatar.hmdAvatarAlignmentTypeChanged
* @param {string} type - "head"
if aligning your head and your avatar's head, "eyes"
if aligning
* your eyes and your avatar's eyes.
* @returns {Signal}
*/
void hmdAvatarAlignmentTypeChanged(const QString& type);
/**jsdoc
* Triggered when the avatar's sensorToWorldScale
property value changes.
* @function MyAvatar.sensorToWorldScaleChanged
* @param {number} scale - The scale that transforms dimensions in the user's real world to the avatar's size in the virtual
* world.
* @returns {Signal}
*/
void sensorToWorldScaleChanged(float sensorToWorldScale);
/**jsdoc
* Triggered when the a model is attached to or detached from one of the avatar's joints using one of
* {@link MyAvatar.attach|attach}, {@link MyAvatar.detachOne|detachOne}, {@link MyAvatar.detachAll|detachAll}, or
* {@link MyAvatar.setAttachmentData|setAttachmentData}.
* @function MyAvatar.attachmentsChanged
* @returns {Signal}
* @deprecated This signal is deprecated and will be removed. Use avatar entities instead.
*/
void attachmentsChanged();
/**jsdoc
* Triggered when the avatar's size changes. This can be due to the user changing the size of their avatar or the domain
* limiting the size of their avatar.
* @function MyAvatar.scaleChanged
* @returns {Signal}
*/
void scaleChanged();
/**jsdoc
* Triggered when the hand touch effect is enabled or disabled for the avatar.
* The hand touch effect makes the avatar's fingers adapt to the shape of any object grabbed, creating the effect that * it is really touching that object.
* @function MyAvatar.shouldDisableHandTouchChanged * @param {boolean} disabled -true
if the hand touch effect is disabled for the avatar,
* false
if it isn't disabled.
* @returns {Signal}
*/
void shouldDisableHandTouchChanged(bool shouldDisable);
/**jsdoc
* Triggered when the hand touch is enabled or disabled on a specific entity.
* The hand touch effect makes the avatar's fingers adapt to the shape of any object grabbed, creating the effect that * it is really touching that object.
* @function MyAvatar.disableHandTouchForIDChanged * @param {Uuid} entityID - The entity that the hand touch effect has been enabled or disabled for. * @param {boolean} disabled -true
if the hand touch effect is disabled for the entity,
* false
if it isn't disabled.
* @returns {Signal}
*/
void disableHandTouchForIDChanged(const QUuid& entityID, bool disable);
private slots:
void leaveDomain();
void updateCollisionCapsuleCache();
protected:
void handleChangedAvatarEntityData();
virtual void beParentOfChild(SpatiallyNestablePointer newChild) const override;
virtual void forgetChild(SpatiallyNestablePointer newChild) const override;
virtual void recalculateChildCauterization() const override;
private:
bool updateStaleAvatarEntityBlobs() const;
bool requiresSafeLanding(const glm::vec3& positionIn, glm::vec3& positionOut);
virtual QByteArray toByteArrayStateful(AvatarDataDetail dataDetail, bool dropFaceTracking) override;
void simulate(float deltaTime, bool inView) override;
void updateFromTrackers(float deltaTime);
void saveAvatarUrl();
virtual void render(RenderArgs* renderArgs) override;
virtual bool shouldRenderHead(const RenderArgs* renderArgs) const override;
void setShouldRenderLocally(bool shouldRender) { _shouldRender = shouldRender; setEnableMeshVisible(shouldRender); }
bool getShouldRenderLocally() const { return _shouldRender; }
void setHasScriptedBlendshapes(bool hasScriptedBlendshapes);
bool getHasScriptedBlendshapes() const override { return _hasScriptedBlendShapes; }
void setHasProceduralBlinkFaceMovement(bool hasProceduralBlinkFaceMovement);
bool getHasProceduralBlinkFaceMovement() const override { return _headData->getHasProceduralBlinkFaceMovement(); }
void setHasProceduralEyeFaceMovement(bool hasProceduralEyeFaceMovement);
bool getHasProceduralEyeFaceMovement() const override { return _headData->getHasProceduralEyeFaceMovement(); }
void setHasAudioEnabledFaceMovement(bool hasAudioEnabledFaceMovement);
bool getHasAudioEnabledFaceMovement() const override { return _headData->getHasAudioEnabledFaceMovement(); }
void setRotationRecenterFilterLength(float length);
float getRotationRecenterFilterLength() const { return _rotationRecenterFilterLength; }
void setRotationThreshold(float angleRadians);
float getRotationThreshold() const { return _rotationThreshold; }
void setEnableStepResetRotation(bool stepReset) { _stepResetRotationEnabled = stepReset; }
bool getEnableStepResetRotation() const { return _stepResetRotationEnabled; }
void setEnableDrawAverageFacing(bool drawAverage) { _drawAverageFacingEnabled = drawAverage; }
bool getEnableDrawAverageFacing() const { return _drawAverageFacingEnabled; }
virtual bool isMyAvatar() const override { return true; }
virtual int parseDataFromBuffer(const QByteArray& buffer) override;
virtual glm::vec3 getSkeletonPosition() const override;
int _skeletonModelChangeCount { 0 };
void saveAvatarScale();
glm::vec3 getScriptedMotorVelocity() const { return _scriptedMotorVelocity; }
float getScriptedMotorTimescale() const { return _scriptedMotorTimescale; }
QString getScriptedMotorFrame() const;
QString getScriptedMotorMode() const;
void setScriptedMotorVelocity(const glm::vec3& velocity);
void setScriptedMotorTimescale(float timescale);
void setScriptedMotorFrame(QString frame);
void setScriptedMotorMode(QString mode);
// Attachments
virtual void attach(const QString& modelURL, const QString& jointName = QString(),
const glm::vec3& translation = glm::vec3(), const glm::quat& rotation = glm::quat(),
float scale = 1.0f, bool isSoft = false,
bool allowDuplicates = false, bool useSaved = true) override;
virtual void detachOne(const QString& modelURL, const QString& jointName = QString()) override;
virtual void detachAll(const QString& modelURL, const QString& jointName = QString()) override;
// Attachments/Avatar Entity
void attachmentDataToEntityProperties(const AttachmentData& data, EntityItemProperties& properties);
AttachmentData entityPropertiesToAttachmentData(const EntityItemProperties& properties) const;
bool findAvatarEntity(const QString& modelURL, const QString& jointName, QUuid& entityID);
bool cameraInsideHead(const glm::vec3& cameraPosition) const;
void updateEyeContactTarget(float deltaTime);
// These are made private for MyAvatar so that you will use the "use" methods instead
virtual void setSkeletonModelURL(const QUrl& skeletonModelURL) override;
virtual void updatePalms() override {}
void lateUpdatePalms();
void clampTargetScaleToDomainLimits();
void clampScaleChangeToDomainLimits(float desiredScale);
glm::mat4 computeCameraRelativeHandControllerMatrix(const glm::mat4& controllerSensorMatrix) const;
std::array