AvatarList and AvatarManager JSDoc

This commit is contained in:
David Rowe 2019-04-04 10:11:54 +13:00
parent f926298020
commit 2a17ad3da5
11 changed files with 277 additions and 72 deletions

View file

@ -946,6 +946,18 @@ void AvatarManager::setAvatarSortCoefficient(const QString& name, const QScriptV
}
}
/**jsdoc
* PAL (People Access List) data for an avatar.
* @typedef {object} AvatarManager.PalData
* @property {Uuid} sessionUUID - The avatar's session ID. <code>""</code> if the avatar is your own.
* @property {string} sessionDisplayName - The avatar's display name, sanitized and versioned, as defined by the avatar mixer.
* It is unique among all avatars present in the domain at the time.
* @property {number} audioLoudness - The instantaneous loudness of the audio input that the avatar is injecting into the
* domain.
* @property {boolean} isReplicated - <strong>Deprecated.</strong>
* @property {Vec3} position - The position of the avatar.
* @property {number} palOrbOffset - The vertical offset from the avatar's position that an overlay orb should be displayed at.
*/
QVariantMap AvatarManager::getPalData(const QStringList& specificAvatarIdentifiers) {
QJsonArray palData;

View file

@ -37,10 +37,11 @@
using SortedAvatar = std::pair<float, std::shared_ptr<Avatar>>;
/**jsdoc
* The AvatarManager API has properties and methods which manage Avatars within the same domain.
* The <code>AvatarManager</code> API provides information about avatars within the domain. The avatars available are those
* that Interface has displayed and so knows about.
*
* <p><strong>Note:</strong> This API is also provided to Interface and client entity scripts as the synonym,
* <code>AvatarList</code>. For assignment client scripts, see the separate {@link AvatarList} API.
* <p><strong>Warning:</strong> This API is also provided to Interface, client entity, and avatar scripts as the synonym,
* "<code>AvatarList</code>". For assignment client scripts, see the separate {@link AvatarList} API.</p>
*
* @namespace AvatarManager
*
@ -48,8 +49,9 @@ using SortedAvatar = std::pair<float, std::shared_ptr<Avatar>>;
* @hifi-client-entity
* @hifi-avatar
*
* @borrows AvatarList.getAvatarIdentifiers as getAvatarIdentifiers
* @borrows AvatarList.getAvatarsInRange as getAvatarsInRange
* @borrows AvatarList.getAvatar as getAvatar
* @comment AvatarList.getAvatarIdentifiers as getAvatarIdentifiers - Don't borrow because behavior is slightly different.
* @comment AvatarList.getAvatarsInRange as getAvatarsInRange - Don't borrow because behavior is slightly different.
* @borrows AvatarList.avatarAddedEvent as avatarAddedEvent
* @borrows AvatarList.avatarRemovedEvent as avatarRemovedEvent
* @borrows AvatarList.avatarSessionChangedEvent as avatarSessionChangedEvent
@ -67,6 +69,31 @@ class AvatarManager : public AvatarHashMap {
public:
/**jsdoc
* Gets the IDs of all avatars known about in the domain.
* Your own avatar is included in the list as a <code>null</code> value.
* @function AvatarManager.getAvatarIdentifiers
* @returns {Uuid[]} The IDs of all known avatars in the domain.
* @example <caption>Report the IDS of all avatars within the domain.</caption>
* var avatars = AvatarManager.getAvatarIdentifiers();
* print("Avatars in the domain: " + JSON.stringify(avatars));
* // A null item is included for your avatar.
*/
/**jsdoc
* Gets the IDs of all avatars known about within a specified distance from a point.
* Your own avatar's ID is included in the list if it is in range.
* @function AvatarManager.getAvatarsInRange
* @param {Vec3} position - The point about which the search is performed.
* @param {number} range - The search radius.
* @returns {Uuid[]} The IDs of all known avatars within the search distance from the position.
* @example <caption>Report the IDs of all avatars within 10m of your avatar.</caption>
* var RANGE = 10;
* var avatars = AvatarManager.getAvatarsInRange(MyAvatar.position, RANGE);
* print("Nearby avatars: " + JSON.stringify(avatars));
* print("Own avatar: " + MyAvatar.sessionUUID);
*/
/// Registers the script types associated with the avatar manager.
static void registerMetaTypes(QScriptEngine* engine);
@ -79,9 +106,7 @@ public:
glm::vec3 getMyAvatarPosition() const { return _myAvatar->getWorldPosition(); }
/**jsdoc
* @function AvatarManager.getAvatar
* @param {Uuid} avatarID
* @returns {AvatarData}
* @comment Uses the base class's JSDoc.
*/
// Null/Default-constructed QUuids will return MyAvatar
Q_INVOKABLE virtual ScriptAvatarData* getAvatar(QUuid avatarID) override { return new ScriptAvatar(getAvatarBySessionID(avatarID)); }
@ -112,36 +137,53 @@ public:
void handleCollisionEvents(const CollisionEvents& collisionEvents);
/**jsdoc
* Gets the amount of avatar mixer data being generated by an avatar other than your own.
* @function AvatarManager.getAvatarDataRate
* @param {Uuid} sessionID
* @param {string} [rateName=""]
* @returns {number}
* @param {Uuid} sessionID - The ID of the avatar to get the data rate for.
* @param {AvatarDataRate} [rateName=""] - The type of avatar mixer data to get the data rate of.
* @returns {number} The data rate in kbps; <code>0</code> if the avatar is your own.
*/
Q_INVOKABLE float getAvatarDataRate(const QUuid& sessionID, const QString& rateName = QString("")) const;
/**jsdoc
* Gets the update rate of avatar mixer data being generated by an avatar other than your own.
* @function AvatarManager.getAvatarUpdateRate
* @param {Uuid} sessionID
* @param {string} [rateName=""]
* @returns {number}
* @param {Uuid} sessionID - The ID of the avatar to get the update rate for.
* @param {AvatarUpdateRate} [rateName=""] - The type of avatar mixer data to get the update rate of.
* @returns {number} The update rate in Hz; <code>0</code> if the avatar is your own.
*/
Q_INVOKABLE float getAvatarUpdateRate(const QUuid& sessionID, const QString& rateName = QString("")) const;
/**jsdoc
* Gets the simulation rate of an avatar other than your own.
* @function AvatarManager.getAvatarSimulationRate
* @param {Uuid} sessionID
* @param {string} [rateName=""]
* @returns {number}
* @param {Uuid} sessionID - The ID of the avatar to get the simulation rate for.
* @param {AvatarSimulationRate} [rateName=""] - The type of avatar data to get the simulation rate of.
* @returns {number} The simulation rate in Hz; <code>0</code> if the avatar is your own.
*/
Q_INVOKABLE float getAvatarSimulationRate(const QUuid& sessionID, const QString& rateName = QString("")) const;
/**jsdoc
* Find the first avatar intersected by a {@link PickRay}.
* @function AvatarManager.findRayIntersection
* @param {PickRay} ray
* @param {Uuid[]} [avatarsToInclude=[]]
* @param {Uuid[]} [avatarsToDiscard=[]]
* @param {boolean} pickAgainstMesh
* @returns {RayToAvatarIntersectionResult}
* @param {PickRay} ray - The ray to use for finding avatars.
* @param {Uuid[]} [avatarsToInclude=[]] - If not empty then search is restricted to these avatars.
* @param {Uuid[]} [avatarsToDiscard=[]] - Avatars to ignore in the search.
* @param {boolean} [pickAgainstMesh=true] - If <code>true</code> then the exact intersection with the avatar mesh is
* calculated, if <code>false</code> then the intersection is approximate.
* @returns {RayToAvatarIntersectionResult} The result of the search for the first intersected avatar.
* @example <caption>Find the first avatar directly in front of you.</caption>
* var pickRay = {
* origin: MyAvatar.position,
* direction: Quat.getFront(MyAvatar.orientation)
* };
*
* var intersection = AvatarManager.findRayIntersection(pickRay);
* if (intersection.intersects) {
* print("Avatar found: " + JSON.stringify(intersection));
* } else {
* print("No avatar found.");
* }
*/
Q_INVOKABLE RayToAvatarIntersectionResult findRayIntersection(const PickRay& ray,
const QScriptValue& avatarIdsToInclude = QScriptValue(),
@ -149,11 +191,12 @@ public:
bool pickAgainstMesh = true);
/**jsdoc
* @function AvatarManager.findRayIntersectionVector
* @param {PickRay} ray
* @param {Uuid[]} avatarsToInclude
* @param {Uuid[]} avatarsToDiscard
* @param {boolean} pickAgainstMesh
* @returns {RayToAvatarIntersectionResult}
* @param {PickRay} ray - Ray.
* @param {Uuid[]} avatarsToInclude - Avatars to include.
* @param {Uuid[]} avatarsToDiscard - Avatars to discard.
* @param {boolean} pickAgainstMesh - Pick against mesh.
* @returns {RayToAvatarIntersectionResult} Intersection result.
* @deprecated This function is deprecated and will be removed.
*/
Q_INVOKABLE RayToAvatarIntersectionResult findRayIntersectionVector(const PickRay& ray,
const QVector<EntityItemID>& avatarsToInclude,
@ -162,10 +205,11 @@ public:
/**jsdoc
* @function AvatarManager.findParabolaIntersectionVector
* @param {PickParabola} pick
* @param {Uuid[]} avatarsToInclude
* @param {Uuid[]} avatarsToDiscard
* @returns {ParabolaToAvatarIntersectionResult}
* @param {PickParabola} pick - Pick.
* @param {Uuid[]} avatarsToInclude - Avatars to include.
* @param {Uuid[]} avatarsToDiscard - Avatars to discard.
* @returns {ParabolaToAvatarIntersectionResult} Intersection result.
* @deprecated This function is deprecated and will be removed.
*/
Q_INVOKABLE ParabolaToAvatarIntersectionResult findParabolaIntersectionVector(const PickParabola& pick,
const QVector<EntityItemID>& avatarsToInclude,
@ -173,27 +217,31 @@ public:
/**jsdoc
* @function AvatarManager.getAvatarSortCoefficient
* @param {string} name
* @returns {number}
* @param {string} name - Name.
* @returns {number} Value.
* @deprecated This function is deprecated and will be removed.
*/
// TODO: remove this HACK once we settle on optimal default sort coefficients
Q_INVOKABLE float getAvatarSortCoefficient(const QString& name);
/**jsdoc
* @function AvatarManager.setAvatarSortCoefficient
* @param {string} name
* @param {number} value
* @param {string} name - Name
* @param {number} value - Value.
* @deprecated This function is deprecated and will be removed.
*/
Q_INVOKABLE void setAvatarSortCoefficient(const QString& name, const QScriptValue& value);
/**jsdoc
* Used in the PAL for getting PAL-related data about avatars nearby. Using this method is faster
* than iterating over each avatar and obtaining data about them in JavaScript, as that method
* locks and unlocks each avatar's data structure potentially hundreds of times per update tick.
* Gets PAL (People Access List) data for one or more avatars. Using this method is faster than iterating over each avatar
* and obtaining data about each individually.
* @function AvatarManager.getPalData
* @param {string[]} [specificAvatarIdentifiers=[]] - The list of IDs of the avatars you want the PAL data for.
* If an empty list, the PAL data for all nearby avatars is returned.
* @returns {object[]} An array of objects, each object being the PAL data for an avatar.
* @param {string[]} [avatarIDs=[]] - The IDs of the avatars to get the PAL data for. If empty then PAL
* data is obtained for all avatars.
* @returns {object<"data", AvatarManager.PalData[]>} An array of objects, each object being the PAL data for an avatar.
* @example <caption>Report the PAL data for one nearby avatar.</caption>
* var palData = AvatarManager.getPalData();
* print("PAL data for one avatar: " + JSON.stringify(palData.data[0]));
*/
Q_INVOKABLE QVariantMap getPalData(const QStringList& specificAvatarIdentifiers = QStringList());
@ -209,7 +257,8 @@ public:
public slots:
/**jsdoc
* @function AvatarManager.updateAvatarRenderStatus
* @param {boolean} shouldRenderAvatars
* @param {boolean} shouldRenderAvatars - Should render avatars.
* @deprecated This function is deprecated and will be removed.
*/
void updateAvatarRenderStatus(bool shouldRenderAvatars);

View file

@ -509,6 +509,26 @@ void Avatar::relayJointDataToChildren() {
_reconstructSoftEntitiesJointMap = false;
}
/**jsdoc
* An avatar has different types of data simulated at different rates, in Hz.
*
* <table>
* <thead>
* <tr><th>Rate Name</th><th>Description</th></tr>
* </thead>
* <tbody>
* <tr><td><code>"avatar" or ""</code></td><td>The rate at which the avatar is updated even if not in view.</td></tr>
* <tr><td><code>"avatarInView"</code></td><td>The rate at which the avatar is updated if in view.</td></tr>
* <tr><td><code>"skeletonModel"</code></td><td>The rate at which the skeleton model is being updated, even if there are no
* joint data available.</td></tr>
* <tr><td><code>"jointData"</code></td><td>The rate at which joint data are being updated.</td></tr>
* <tr><td><code>""</code></td><td>When no rate name is specified, the <code>"avatar"</code> update rate is
* provided.</td></tr>
* </tbody>
* </table>
*
* @typedef {string} AvatarSimulationRate
*/
float Avatar::getSimulationRate(const QString& rateName) const {
if (rateName == "") {
return _simulationRate.rate();

View file

@ -501,8 +501,8 @@ public:
/**jsdoc
* @function MyAvatar.getSimulationRate
* @param {string} [rateName=""] - Rate name.
* @returns {number} Simulation rate.
* @param {AvatarSimulationRate} [rateName=""] - Rate name.
* @returns {number} Simulation rate in Hz.
* @deprecated This function is deprecated and will be removed.
*/
Q_INVOKABLE float getSimulationRate(const QString& rateName = QString("")) const;

View file

@ -1545,7 +1545,6 @@ float AvatarData::getDataRate(const QString& rateName) const {
* <tr><th>Rate Name</th><th>Description</th></tr>
* </thead>
* <tbody>
* <tr><td><code>"globalPosition"</code></td><td>Global position.</td></tr>
* <tr><td><code>"localPosition"</code></td><td>Local position.</td></tr>
* <tr><td><code>"avatarBoundingBox"</code></td><td>Avatar bounding box.</td></tr>
@ -1559,7 +1558,6 @@ float AvatarData::getDataRate(const QString& rateName) const {
* <tr><td><code>"faceTracker"</code></td><td>Face tracker data.</td></tr>
* <tr><td><code>"jointData"</code></td><td>Joint data.</td></tr>
* <tr><td><code>"farGrabJointData"</code></td><td>Far grab joint data.</td></tr>
* <tr><td><code>""</code></td><td>When no rate name is specified, the overall update rate is provided.</td></tr>
* </tbody>
* </table>
@ -2905,6 +2903,20 @@ glm::mat4 AvatarData::getControllerRightHandMatrix() const {
return _controllerRightHandMatrixCache.get();
}
/**jsdoc
* Information about a ray-to-avatar intersection.
* @typedef {object} RayToAvatarIntersectionResult
* @property {boolean} intersects - <code>true</code> if an avatar is intersected, <code>false</code> if it isn't.
* @property {string} avatarID - The ID of the avatar that is intersected.
* @property {number} distance - The distance from the ray origin to the intersection.
* @property {string} face - The name of the box face that is intersected; <code>"UNKNOWN_FACE"</code> if mesh was picked
* against.
* @property {Vec3} intersection - The ray intersection point in world coordinates.
* @property {Vec3} surfaceNormal - The surface normal at the intersection point.
* @property {number} jointIndex - The index of the joint intersected.
* @property {SubmeshIntersection} extraInfo - Extra information on the mesh intersected if mesh was picked against,
* <code>{}</code> if it wasn't.
*/
QScriptValue RayToAvatarIntersectionResultToScriptValue(QScriptEngine* engine, const RayToAvatarIntersectionResult& value) {
QScriptValue obj = engine->newObject();
obj.setProperty("intersects", value.intersects);

View file

@ -479,7 +479,8 @@ class AvatarData : public QObject, public SpatiallyNestable {
* avatar. <em>Read-only.</em>
* @property {number} sensorToWorldScale - The scale that transforms dimensions in the user's real world to the avatar's
* size in the virtual world. <em>Read-only.</em>
* @property {boolean} hasPriority - is the avatar in a Hero zone? <em>Read-only.</em>
* @property {boolean} hasPriority - <code>true</code> if the avatar is in a "hero" zone, <code>false</code> if it isn't.
* <em>Read-only.</em>
*/
Q_PROPERTY(glm::vec3 position READ getWorldPosition WRITE setPositionViaScript)
Q_PROPERTY(float scale READ getDomainLimitedScale WRITE setTargetScale)

View file

@ -36,8 +36,10 @@ const int CLIENT_TO_AVATAR_MIXER_BROADCAST_FRAMES_PER_SECOND = 50;
const quint64 MIN_TIME_BETWEEN_MY_AVATAR_DATA_SENDS = USECS_PER_SECOND / CLIENT_TO_AVATAR_MIXER_BROADCAST_FRAMES_PER_SECOND;
/**jsdoc
* <strong>Note:</strong> An <code>AvatarList</code> API is also provided for Interface and client entity scripts: it is a
* synonym for the {@link AvatarManager} API.
* The <code>AvatarList</code> API provides information about avatars within the domain.
*
* <p><strong>Warning:</strong> An API named "<code>AvatarList</code>" is also provided for Interface, client entity, and avatar
* scripts, however, it is a synonym for the {@link AvatarManager} API.</p>
*
* @namespace AvatarList
*
@ -78,23 +80,37 @@ public:
// Currently, your own avatar will be included as the null avatar id.
/**jsdoc
* Gets the IDs of all avatars in the domain.
* <p><strong>Warning:</strong> If the AC script is acting as an avatar (i.e., <code>Agent.isAvatar == true</code>) the
* avatar's ID is NOT included in results.</p>
* @function AvatarList.getAvatarIdentifiers
* @returns {Uuid[]}
* @returns {Uuid[]} The IDs of all avatars in the domain (excluding AC script's avatar).
* @example <caption>Report the IDS of all avatars within the domain.</caption>
* var avatars = AvatarList.getAvatarIdentifiers();
* print("Avatars in the domain: " + JSON.stringify(avatars));
*/
Q_INVOKABLE QVector<QUuid> getAvatarIdentifiers();
/**jsdoc
* Gets the IDs of all avatars within a specified distance from a point.
* <p><strong>Warning:</strong> If the AC script is acting as an avatar (i.e., <code>Agent.isAvatar == true</code>) the
* avatar's ID is NOT included in results.</p>
* @function AvatarList.getAvatarsInRange
* @param {Vec3} position
* @param {number} range
* @returns {Uuid[]}
* @param {Vec3} position - The point about which the search is performed.
* @param {number} range - The search radius.
* @returns {Uuid[]} The IDs of all avatars within the search distance from the position (excluding AC script's avatar).
* @example <caption>Report the IDs of all avatars within 10m of the origin.</caption>
* var RANGE = 10;
* var avatars = AvatarList.getAvatarsInRange(Vec3.ZERO, RANGE);
* print("Avatars near the origin: " + JSON.stringify(avatars));
*/
Q_INVOKABLE QVector<QUuid> getAvatarsInRange(const glm::vec3& position, float rangeMeters) const;
/**jsdoc
* Gets information about an avatar.
* @function AvatarList.getAvatar
* @param {Uuid} avatarID
* @returns {AvatarData}
* @param {Uuid} avatarID - The ID of the avatar.
* @returns {AvatarData} Information about the avatar.
*/
// Null/Default-constructed QUuids will return MyAvatar
Q_INVOKABLE virtual ScriptAvatarData* getAvatar(QUuid avatarID) { return new ScriptAvatarData(getAvatarBySessionID(avatarID)); }
@ -110,34 +126,57 @@ public:
signals:
/**jsdoc
* Triggered when an avatar arrives in the domain.
* @function AvatarList.avatarAddedEvent
* @param {Uuid} sessionUUID
* @param {Uuid} sessionUUID - The ID of the avatar that arrived in the domain.
* @returns {Signal}
* @example <caption>Report when an avatar arrives in the domain.</caption>
* AvatarManager.avatarAddedEvent.connect(function (sessionID) {
* print("Avatar arrived: " + sessionID);
* });
*
* // Note: If using from the AvatarList API, replace "AvatarManager" with "AvatarList".
*/
void avatarAddedEvent(const QUuid& sessionUUID);
/**jsdoc
* Triggered when an avatar leaves the domain.
* @function AvatarList.avatarRemovedEvent
* @param {Uuid} sessionUUID
* @param {Uuid} sessionUUID - The ID of the avatar that left the domain.
* @returns {Signal}
* @example <caption>Report when an avatar leaves the domain.</caption>
* AvatarManager.avatarRemovedEvent.connect(function (sessionID) {
* print("Avatar left: " + sessionID);
* });
*
* // Note: If using from the AvatarList API, replace "AvatarManager" with "AvatarList".
*/
void avatarRemovedEvent(const QUuid& sessionUUID);
/**jsdoc
* Triggered when an avatar's session ID changes.
* @function AvatarList.avatarSessionChangedEvent
* @param {Uuid} sessionUUID
* @param {Uuid} oldSessionUUID
* @param {Uuid} newSessionUUID - The new session ID.
* @param {Uuid} oldSessionUUID - The old session ID.
* @returns {Signal}
* @example <caption>Report when an avatar's session ID changes.</caption>
* AvatarManager.avatarSessionChangedEvent.connect(function (newSessionID, oldSessionID) {
* print("Avatar session ID changed from " + oldSessionID + " to " + newSessionID);
* });
*
* // Note: If using from the AvatarList API, replace "AvatarManager" with "AvatarList".
*/
void avatarSessionChangedEvent(const QUuid& sessionUUID,const QUuid& oldUUID);
public slots:
/**jsdoc
* Checks whether there is an avatar within a specified distance from a point.
* @function AvatarList.isAvatarInRange
* @param {string} position
* @param {string} range
* @returns {boolean}
* @param {string} position - The test position.
* @param {string} range - The test distance.
* @returns {boolean} <code>true</code> if there's an avatar within the specified distance of the point, <code>false</code>
* if not.
*/
bool isAvatarInRange(const glm::vec3 & position, const float range);
@ -145,36 +184,41 @@ protected slots:
/**jsdoc
* @function AvatarList.sessionUUIDChanged
* @param {Uuid} sessionUUID
* @param {Uuid} oldSessionUUID
* @param {Uuid} sessionUUID - New session ID.
* @param {Uuid} oldSessionUUID - Old session ID.
* @deprecated This function is deprecated and will be removed.
*/
void sessionUUIDChanged(const QUuid& sessionUUID, const QUuid& oldUUID);
/**jsdoc
* @function AvatarList.processAvatarDataPacket
* @param {} message
* @param {} sendingNode
* @param {object} message - Message.
* @param {object} sendingNode - Sending node.
* @deprecated This function is deprecated and will be removed.
*/
void processAvatarDataPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
/**jsdoc
* @function AvatarList.processAvatarIdentityPacket
* @param {} message
* @param {} sendingNode
* @param {object} message - Message.
* @param {object} sendingNode - Sending node.
* @deprecated This function is deprecated and will be removed.
*/
void processAvatarIdentityPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
/**jsdoc
* @function AvatarList.processBulkAvatarTraits
* @param {} message
* @param {} sendingNode
* @param {object} message - Message.
* @param {object} sendingNode - Sending node.
* @deprecated This function is deprecated and will be removed.
*/
void processBulkAvatarTraits(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
/**jsdoc
* @function AvatarList.processKillAvatar
* @param {} message
* @param {} sendingNode
* @param {object} message - Message.
* @param {object} sendingNode - Sending node.
* @deprecated This function is deprecated and will be removed.
*/
void processKillAvatar(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);

View file

@ -16,6 +16,52 @@
#include "AvatarData.h"
/**jsdoc
* Information about an avatar.
* @typedef {object} AvatarData
* @property {Vec3} position - The avatar's position.
* @property {number} scale - The target scale of the avatar without any restrictions on permissible values imposed by the
* domain.
* @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} bodyPitch - The pitch of the avatar's body, in degrees.
* @property {number} bodyYaw - The yaw of the avatar's body, in degrees.
* @property {number} bodyRoll - The roll of the avatar's body, in degrees.
* @property {Quat} orientation - The orientation of the avatar's body.
* @property {Quat} headOrientation - The orientation of the avatar's head.
* @property {number} headPitch - The pitch of the avatar's head relative to the body, in degrees.
* @property {number} headYaw - The yaw of the avatar's head relative to the body, in degrees.
* @property {number} headRoll - The roll of the avatar's head relative to the body, in degrees.
*
* @property {Vec3} velocity - The linear velocity of the avatar.
* @property {Vec3} angularVelocity - The angular velocity of the avatar.
*
* @property {Uuid} sessionUUID - The avatar's session ID.
* @property {string} displayName - The avatar's display name.
* @property {string} sessionDisplayName - The avatar's display name, sanitized and versioned, as defined by the avatar mixer.
* It is unique among all avatars present in the domain at the time.
* @property {boolean} isReplicated - <strong>Deprecated.</strong>
* @property {boolean} lookAtSnappingEnabled - <code>true</code> 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 <code>lookAtSnappingEnabled == true</code>.
*
* @property {string} skeletonModelURL - The avatar's FST file.
* @property {AttachmentData[]} attachmentData - Information on the avatar's attachments.<br />
* <strong>Deprecated:</strong> Use avatar entities insteada.
* @property {string[]} jointNames - The list of joints in the current avatar model.
*
* @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 {Mat4} sensorToWorldMatrix - The scale, rotation, and translation transform from the user's real world to the
* avatar's size, orientation, and position in the virtual world.
* @property {Mat4} controllerLeftHandMatrix - The rotation and translation of the left hand controller relative to the avatar.
* @property {Mat4} controllerRightHandMatrix - The rotation and translation of the right hand controller relative to the
* avatar.
*
* @property {boolean} hasPriority - <code>true</code> if the avatar is in a "hero" zone, <code>false</code> if it isn't.
*/
class ScriptAvatarData : public QObject {
Q_OBJECT

View file

@ -442,6 +442,19 @@ bool Model::findRayIntersectionAgainstSubMeshes(const glm::vec3& origin, const g
}
}
/**jsdoc
* Information about a submesh intersection point.
* @typedef {object} SubmeshIntersection
* @property {Vec3} worldIntersectionPoint - The intersection point in world coordinates.
* @property {Vec3} meshIntersectionPoint - The intersection point in model coordinates.
* @property {number} partIndex - The index of the intersected mesh part within the submesh.
* @property {number} shapeID - The index of the mesh part within the model.
* @property {number} subMeshIndex - The index of the intersected submesh within the model.
* @property {string} subMeshName - The name of the intersected submesh.
* @property {Triangle} subMeshTriangleWorld - The vertexes of the intersected mesh part triangle in world coordinates.
* @property {Vec3} subMeshNormal - The normal of the intersected mesh part triangle in model coordinates.
* @property {Triangle} subMeshTriangle - The vertexes of the intersected mesh part triangle in model coordinates.
*/
if (intersectedSomething) {
distance = bestDistance;
face = bestFace;

View file

@ -119,6 +119,13 @@ void swingTwistDecomposition(const glm::quat& rotation,
glm::quat& swing,
glm::quat& twist);
/**jsdoc
* A triangle in a mesh.
* @typedef {object} Triangle
* @property {Vec3} v0 - The position of vertex 0 in the triangle.
* @property {Vec3} v1 - The position of vertex 1 in the triangle.
* @property {Vec3} v2 - The position of vertex 2 in the triangle.
*/
class Triangle {
public:
glm::vec3 v0;

View file

@ -56,6 +56,7 @@ exports.handlers = {
'../../libraries/physics/src',
'../../libraries/plugins/src/plugins',
'../../libraries/pointers/src',
'../../libraries/render-utils/src',
'../../libraries/script-engine/src',
'../../libraries/shared/src',
'../../libraries/shared/src/shared',