From 73fd61dcf07ed22e9bf61405e076b88859a7e069 Mon Sep 17 00:00:00 2001
From: David Rowe
Date: Thu, 25 Apr 2019 13:14:04 +1200
Subject: [PATCH 01/11] Picks, PickType, RayPick JSDoc update
---
interface/src/raypick/CollisionPick.cpp | 31 ++
interface/src/raypick/ParabolaPick.h | 17 ++
.../src/raypick/PickScriptingInterface.cpp | 167 +++++++----
.../src/raypick/PickScriptingInterface.h | 281 ++++++++++--------
.../src/raypick/PointerScriptingInterface.h | 2 +-
interface/src/raypick/RayPick.h | 15 +
.../src/raypick/RayPickScriptingInterface.h | 101 +++++--
interface/src/raypick/StylusPick.h | 12 +
.../entities/src/EntityItemProperties.cpp | 2 +-
libraries/pointers/src/Pick.h | 44 ++-
libraries/render-utils/src/Model.cpp | 2 +-
libraries/shared/src/PhysicsCollisionGroups.h | 4 +-
libraries/shared/src/PickFilter.h | 28 ++
libraries/shared/src/RegisteredMetaTypes.h | 71 +++--
libraries/shared/src/ShapeInfo.cpp | 2 +
15 files changed, 512 insertions(+), 267 deletions(-)
diff --git a/interface/src/raypick/CollisionPick.cpp b/interface/src/raypick/CollisionPick.cpp
index 82d75257df..b3888ae3a0 100644
--- a/interface/src/raypick/CollisionPick.cpp
+++ b/interface/src/raypick/CollisionPick.cpp
@@ -57,6 +57,37 @@ void buildObjectIntersectionsMap(IntersectionType intersectionType, const std::v
}
}
+/**jsdoc
+ * An intersection result for a collision pick.
+ *
+ * @typedef {object} CollisionPickResult
+ * @property {boolean} intersects - truen if there is at least one intersection, false if there isn't.
+ * @property {IntersectingObject[]} intersectingObjects - All objects which intersect with the collisionRegion.
+ * @property {CollisionRegion} collisionRegion - The collision region that was used. Valid even if there was no intersection.
+ */
+
+/**jsdoc
+ * Information about a {@link CollisionPick}'s intersection with an object.
+ *
+ * @typedef {object} IntersectingObject
+ * @property {Uuid} id - The ID of the object.
+ * @property {IntersectionType} type - The type of the object, either 1 for INTERSECTED_ENTITY or 3
+ * for INTERSECTED_AVATAR.
+ * @property {CollisionContact[]} collisionContacts - Information on the penetration between the pick and the object.
+ */
+
+/**jsdoc
+ * A pair of points that represents part of an overlap between a {@link CollisionPick} and an object in the physics engine.
+ * Points which are further apart represent deeper overlap.
+ *
+ * @typedef {object} CollisionContact
+ * @property {Vec3} pointOnPick - A point representing a penetration of the object's surface into the volume of the pick, in
+ * world coordinates.
+ * @property {Vec3} pointOnObject - A point representing a penetration of the pick's surface into the volume of the object, in
+ * world coordinates.
+ * @property {Vec3} normalOnPick - The normal vector pointing away from the pick, representing the direction of collision.
+ */
+
QVariantMap CollisionPickResult::toVariantMap() const {
QVariantMap variantMap;
diff --git a/interface/src/raypick/ParabolaPick.h b/interface/src/raypick/ParabolaPick.h
index 0adbb01954..78c35e13b4 100644
--- a/interface/src/raypick/ParabolaPick.h
+++ b/interface/src/raypick/ParabolaPick.h
@@ -42,6 +42,23 @@ public:
float parabolicDistance { FLT_MAX };
bool intersects { false };
+ /**jsdoc
+ * An intersection result for a parabola pick.
+ *
+ * @typedef {object} ParabolaPickResult
+ * @property {number} type - The intersection type.
+ * @property {boolean} intersects - true if there's a valid intersection, false if there isn't.
+ * @property {Uuid} objectID - The ID of the intersected object. null for HUD or invalid intersections.
+ * @property {number} distance - The distance from the parabola origin to the intersection point in a straight line.
+ * @property {number} parabolicDistance - The distance from the parabola origin to the intersection point along the arc of
+ * the parabola.
+ * @property {Vec3} intersection - The intersection point in world coordinates.
+ * @property {Vec3} surfaceNormal - The surface normal at the intersected point. All NaNs if type ==
+ * Picks.INTERSECTED_HUD.
+ * @property {SubmeshIntersection} extraInfo - Additional intersection details for model objects, otherwise
+ * { }.
+ * @property {PickParabola} parabola - The pick parabola that was used. Valid even if there is no intersection.
+ */
virtual QVariantMap toVariantMap() const override {
QVariantMap toReturn;
toReturn["type"] = type;
diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp
index 09f4b68cb9..7e87ac22a7 100644
--- a/interface/src/raypick/PickScriptingInterface.cpp
+++ b/interface/src/raypick/PickScriptingInterface.cpp
@@ -55,23 +55,37 @@ PickFilter getPickFilter(unsigned int filter) {
}
/**jsdoc
- * A set of properties that can be passed to {@link Picks.createPick} to create a new Ray Pick.
+ * A set of properties that can be passed to {@link Picks.createPick} when creating a new ray pick.
+ *
* @typedef {object} Picks.RayPickProperties
- * @property {boolean} [enabled=false] If this Pick should start enabled or not. Disabled Picks do not updated their pick results.
- * @property {number} [filter=0] The filter for this Pick to use, constructed using filter flags combined using bitwise OR.
- * @property {number} [maxDistance=0.0] The max distance at which this Pick will intersect. 0.0 = no max. < 0.0 is invalid.
- * @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, or a pick.
- * @property {number} [parentJointIndex=0] - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint)
- * @property {string} joint - If "Mouse," parents the pick to the mouse. If "Avatar," parents the pick to MyAvatar's head. Otherwise, parents to the joint of the given name on MyAvatar.
- * @property {Vec3} [posOffset=Vec3.ZERO] Only for Joint Ray Picks. A local joint position offset, in meters. x = upward, y = forward, z = lateral
- * @property {Vec3} [dirOffset=Vec3.UP] Only for Joint Ray Picks. A local joint direction offset. x = upward, y = forward, z = lateral
- * @property {Vec3} [position] Only for Static Ray Picks. The world-space origin of the ray.
- * @property {Vec3} [direction=-Vec3.UP] Only for Static Ray Picks. The world-space direction of the ray.
+ * @property {boolean} [enabled=false] - true if this pick should start enabled, false if it should
+ * start disabled. Disabled picks do not update their pick results.
+ * @property {FilterFlags} [filter=0] - The filter for this pick to use. Construct using {@link Picks} FilterFlags property
+ * values (e.g., Picks.PICK_DOMAIN_ENTTITIES) combined with | (bitwise OR) operators.
+ * @property {number} [maxDistance=0.0] - The maximum distance at which this pick will intersect. A value of 0.0
+ * means no maximum.
+ * @property {Uuid} [parentID] - The ID of the parent: either an avatar, an entity, or another pick.
+ * @property {number} [parentJointIndex=0] - The joint of the parent to parent to, for example, an avatar joint.
+ * A value of 0 means no joint.
+ * Used only if parentID is specified.
+ * @property {string} [joint] - "Mouse" parents the pick to the mouse; "Avatar" parents the pick to
+ * the user's avatar head; a joint name parents to the joint in the user's avatar; otherwise the pick is "static", not
+ * parented to anything.
+ * Used only if parentID is not specified.
+ * @property {Vec3} [position=Vec3.ZERO] - The offset of the ray origin from its parent if parented, otherwise the ray origin
+ * in world coordinates.
+ * @property {Vec3} [posOffset] - Synonym for position.
+ * @property {Vec3} [direction] - The offset of the ray direction from its parent's y-axis if parented, otherwise the ray
+ * direction in world coordinates.
+ *
Default Value:Vec3.UP direction if joint is specified, otherwise
+ * -Vec3.UP.
+ * @property {Vec3} [dirOffset] - Synonym for direction.
+ * @property {Quat} [orientation] - Alternative property for specifying direction. The value is applied to the
+ * default direction value.
*/
unsigned int PickScriptingInterface::createRayPick(const QVariant& properties) {
QVariantMap propMap = properties.toMap();
-
#if defined (Q_OS_ANDROID)
QString jointName { "" };
if (propMap["joint"].isValid()) {
@@ -124,12 +138,20 @@ unsigned int PickScriptingInterface::createRayPick(const QVariant& properties) {
}
/**jsdoc
- * A set of properties that can be passed to {@link Picks.createPick} to create a new Stylus Pick.
+ * A set of properties that can be passed to {@link Picks.createPick} when creating a new stylus pick.
+ *
* @typedef {object} Picks.StylusPickProperties
- * @property {number} [hand=-1] An integer. 0 == left, 1 == right. Invalid otherwise.
- * @property {boolean} [enabled=false] If this Pick should start enabled or not. Disabled Picks do not updated their pick results.
- * @property {number} [filter=0] The filter for this Pick to use, constructed using filter flags combined using bitwise OR.
- * @property {number} [maxDistance=0.0] The max distance at which this Pick will intersect. 0.0 = no max. < 0.0 is invalid.
+ * @property {number} [hand=-1] 0 for the left hand, 1 for the right hand, invalid (-1)
+ * otherwise.
+ * @property {boolean} [enabled=false] - true if this pick should start enabled, false if it should
+ * start disabled. Disabled picks do not update their pick results.
+ * @property {number} [filter=0] - The filter for this pick to use. Construct using {@link Picks} FilterFlags property
+ * values (e.g., Picks.PICK_DOMAIN_ENTTITIES) combined with | (bitwise OR) operators.
+ *
Note: Stylus picks do not intersect avatars or the HUD.
+ * @property {number} [maxDistance=0.0] - The maximum distance at which this pick will intersect. A value of 0.0
+ * means no maximum.
+ * @property {Vec3} [tipOffset=0,0.095,0] - The position of the stylus tip relative to the hand position at default avatar
+ * scale.
*/
unsigned int PickScriptingInterface::createStylusPick(const QVariant& properties) {
QVariantMap propMap = properties.toMap();
@@ -167,23 +189,45 @@ unsigned int PickScriptingInterface::createStylusPick(const QVariant& properties
// NOTE: Laser pointer still uses scaleWithAvatar. Until scaleWithAvatar is also deprecated for pointers, scaleWithAvatar should not be removed from the pick API.
/**jsdoc
- * A set of properties that can be passed to {@link Picks.createPick} to create a new Parabola Pick.
+ * A set of properties that can be passed to {@link Picks.createPick} when creating a new parabola pick.
+ *
* @typedef {object} Picks.ParabolaPickProperties
- * @property {boolean} [enabled=false] If this Pick should start enabled or not. Disabled Picks do not updated their pick results.
- * @property {number} [filter=0] The filter for this Pick to use, constructed using filter flags combined using bitwise OR.
- * @property {number} [maxDistance=0.0] The max distance at which this Pick will intersect. 0.0 = no max. < 0.0 is invalid.
- * @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, or a pick.
- * @property {number} [parentJointIndex=0] - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint)
- * @property {string} joint - If "Mouse," parents the pick to the mouse. If "Avatar," parents the pick to MyAvatar's head. Otherwise, parents to the joint of the given name on MyAvatar.
- * @property {Vec3} [posOffset=Vec3.ZERO] Only for Joint Parabola Picks. A local joint position offset, in meters. x = upward, y = forward, z = lateral
- * @property {Vec3} [dirOffset=Vec3.UP] Only for Joint Parabola Picks. A local joint direction offset. x = upward, y = forward, z = lateral
- * @property {Vec3} [position] Only for Static Parabola Picks. The world-space origin of the parabola segment.
- * @property {Vec3} [direction=-Vec3.FRONT] Only for Static Parabola Picks. The world-space direction of the parabola segment.
- * @property {number} [speed=1] The initial speed of the parabola, i.e. the initial speed of the projectile whose trajectory defines the parabola.
- * @property {Vec3} [accelerationAxis=-Vec3.UP] The acceleration of the parabola, i.e. the acceleration of the projectile whose trajectory defines the parabola, both magnitude and direction.
- * @property {boolean} [rotateAccelerationWithAvatar=true] Whether or not the acceleration axis should rotate with the avatar's local Y axis.
- * @property {boolean} [rotateAccelerationWithParent=false] Whether or not the acceleration axis should rotate with the parent's local Y axis, if available.
- * @property {boolean} [scaleWithParent=true] If true, the velocity and acceleration of the Pick will scale linearly with the parent, if available. scaleWithAvatar is an alias but is deprecated.
+ * @property {boolean} [enabled=false] - true if this pick should start enabled, false if it should
+ * start disabled. Disabled picks do not update their pick results.
+ * @property {number} [filter=0] - The filter for this pick to use. Construct using {@link Picks} FilterFlags property
+ * values (e.g., Picks.PICK_DOMAIN_ENTTITIES) combined with | (bitwise OR) operators.
+ * @property {number} [maxDistance=0.0] - The maximum distance at which this pick will intersect. A value of 0.0
+ * means no maximum.
+ * @property {Uuid} [parentID] - The ID of the parent: either an avatar, an entity, or another pick.
+ * @property {number} [parentJointIndex=0] - The joint of the parent to parent to, for example, an avatar joint.
+ * A value of 0 means no joint.
+ * Used only if parentID is specified.
+ * @property {string} [joint] - "Mouse" parents the pick to the mouse; "Avatar" parents the pick to
+ * the user's avatar head; a joint name parents to the joint in the user's avatar; otherwise the pick is "static", not
+ * parented to anything.
+ * Used only if parentID is not specified.
+ * @property {Vec3} [position=Vec3.ZERO] - The offset of the parabola origin from its parent if parented, otherwise the
+ * parabola origin in world coordinates.
+ * @property {Vec3} [posOffset] - Synonym for position.
+ * @property {Vec3} [direction] - The offset of the parabola direction from its parent's y-axis if parented, otherwise the
+ * parabola direction in world coordinates.
+ *
Default Value:Vec3.UP direction if joint is specified, otherwise
+ * Vec3.FRONT.
+ * @property {Vec3} [dirOffset] - Synonym for direction.
+ * @property {Quat} [orientation] - Alternative property for specifying direction. The value is applied to the
+ * default direction value.
+ * @property {number} [speed=1] - The initial speed of the parabola in m/s, i.e., the initial speed of a virtual projectile
+ * whose trajectory defines the parabola.
+ * @property {Vec3} [accelerationAxis=-Vec3.UP] - The acceleration of the parabola in m/s2, i.e., the acceleration
+ * of a virtual projectile whose trajectory defines the parabola, both magnitude and direction.
+ * @property {boolean} [rotateAccelerationWithAvatar=true] - true if the acceleration axis should rotate with the
+ * avatar about the avatar's y-axis, false if it shouldn't.
+ * @property {boolean} [rotateAccelerationWithParent=false] - true if the acceleration axis should rotate with the
+ * parent about the parent's y-axis, if available.
+ * @property {boolean} [scaleWithParent=true] - true if the velocity and acceleration of the pick should scale
+ * with the avatar or other parent.
+ * @property {boolean} [scaleWithAvatar=true] - Synonym for scalewithParent.
+ *
Deprecated: This property is deprecated and will be removed.
*/
unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properties) {
QVariantMap propMap = properties.toMap();
@@ -251,35 +295,38 @@ unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properti
return DependencyManager::get()->addPick(PickQuery::Parabola, parabolaPick);
}
-/**jsdoc
-* A Shape defines a physical volume.
-*
-* @typedef {object} Shape
-* @property {string} shapeType The type of shape to use. Can be one of the following: "box", "sphere", "capsule-x", "capsule-y", "capsule-z", "cylinder-x", "cylinder-y", "cylinder-z"
-* @property {Vec3} dimensions - The size to scale the shape to.
-*/
-
-// TODO: Add this property to the Shape jsdoc above once model picks work properly
-// * @property {string} modelURL - If shapeType is one of: "compound", "simple-hull", "simple-compound", or "static-mesh", this defines the model to load to generate the collision volume.
/**jsdoc
-* A set of properties that can be passed to {@link Picks.createPick} to create a new Collision Pick.
-
-* @typedef {object} Picks.CollisionPickProperties
-* @property {boolean} [enabled=false] If this Pick should start enabled or not. Disabled Picks do not updated their pick results.
-* @property {number} [filter=0] The filter for this Pick to use, constructed using filter flags combined using bitwise OR.
-* @property {Shape} shape - The information about the collision region's size and shape. Dimensions are in world space, but will scale with the parent if defined.
-* @property {Vec3} position - The position of the collision region, relative to a parent if defined.
-* @property {Quat} orientation - The orientation of the collision region, relative to a parent if defined.
-* @property {float} threshold - The approximate minimum penetration depth for a test object to be considered in contact with the collision region.
-* The depth is measured in world space, but will scale with the parent if defined.
-* @property {CollisionMask} [collisionGroup=8] - The type of object this collision pick collides as. Objects whose collision masks overlap with the pick's collision group
-* will be considered colliding with the pick.
-* @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, or a pick.
-* @property {number} [parentJointIndex=0] - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint)
-* @property {string} joint - If "Mouse," parents the pick to the mouse. If "Avatar," parents the pick to MyAvatar's head. Otherwise, parents to the joint of the given name on MyAvatar.
-* @property {boolean} [scaleWithParent=true] If true, the collision pick's dimensions and threshold will adjust according to the scale of the parent.
-*/
+ * A set of properties that can be passed to {@link Picks.createPick} when creating a new collision pick.
+ *
+ * @typedef {object} Picks.CollisionPickProperties
+ * @property {boolean} [enabled=false] - true if this pick should start enabled, false if it should
+ * start disabled. Disabled picks do not update their pick results.
+ * @property {FilterFlags} [filter=0] - The filter for this pick to use. Construct using {@link Picks} FilterFlags property
+ * values (e.g., Picks.PICK_DOMAIN_ENTTITIES) combined with | (bitwise OR) operators.
+ *
Note: Collision picks do not intersect the HUD.
+ * @property {number} [maxDistance=0.0] - The maximum distance at which this pick will intersect. A value of 0.0
+ * means no maximum.
+ * @property {Uuid} [parentID] - The ID of the parent: either an avatar, an entity, or another pick.
+ * @property {number} [parentJointIndex=0] - The joint of the parent to parent to, for example, an avatar joint.
+ * A value of 0 means no joint.
+ * Used only if parentID is specified.
+ * @property {string} [joint] - "Mouse" parents the pick to the mouse; "Avatar" parents the pick to
+ * the user's avatar head; a joint name parents to the joint in the user's avatar; otherwise the pick is "static", not
+ * parented to anything.
+ * Used only if parentID is not specified.
+ * @property {boolean} [scaleWithParent=true] - true to scale the pick's dimensions and threshold according to the
+ * scale of the parent.
+ *
+ * @property {Shape} shape - The collision region's shape and size. Dimensions are in world coordinates but scale with the
+ * parent if defined.
+ * @property {Vec3} position - The position of the collision region, relative to the parent if defined.
+ * @property {Quat} orientation - The orientation of the collision region, relative to the parent if defined.
+ * @property {number} threshold - The approximate minimum penetration depth for a test object to be considered in contact with
+ * the collision region. The depth is in world coordinates but scales with the parent if defined.
+ * @property {CollisionMask} [collisionGroup=8] - The type of objects the collision region collides as. Objects whose collision
+ * masks overlap with the regions's collision group are considered to be colliding with the region.
+ */
unsigned int PickScriptingInterface::createCollisionPick(const QVariant& properties) {
QVariantMap propMap = properties.toMap();
diff --git a/interface/src/raypick/PickScriptingInterface.h b/interface/src/raypick/PickScriptingInterface.h
index 6264a3e258..e544262b5f 100644
--- a/interface/src/raypick/PickScriptingInterface.h
+++ b/interface/src/raypick/PickScriptingInterface.h
@@ -17,7 +17,7 @@
#include
/**jsdoc
- * The Picks API lets you create and manage objects for repeatedly calculating intersections in different ways.
+ * The Picks API lets you create and manage objects for repeatedly calculating intersections.
*
* @namespace Picks
*
@@ -25,33 +25,43 @@
* @hifi-client-entity
* @hifi-avatar
*
- * @property {number} PICK_ENTITIES A filter flag. Include domain and avatar entities when intersecting. Read-only.. Deprecated.
- * @property {number} PICK_OVERLAYS A filter flag. Include local entities when intersecting. Read-only.. Deprecated.
+ * @property {FilterFlags} PICK_DOMAIN_ENTITIES - Include domain entities when intersecting. Read-only.
+ * @property {FilterFlags} PICK_AVATAR_ENTITIES - Include avatar entities when intersecting. Read-only.
+ * @property {FilterFlags} PICK_LOCAL_ENTITIES - Include local entities when intersecting. Read-only.
+ * @property {FilterFlags} PICK_AVATARS - Include avatars when intersecting. Read-only.
+ * @property {FilterFlags} PICK_HUD - Include the HUD sphere when intersecting in HMD mode. Read-only.
*
- * @property {number} PICK_DOMAIN_ENTITIES A filter flag. Include domain entities when intersecting. Read-only..
- * @property {number} PICK_AVATAR_ENTITIES A filter flag. Include avatar entities when intersecting. Read-only..
- * @property {number} PICK_LOCAL_ENTITIES A filter flag. Include local entities when intersecting. Read-only..
- * @property {number} PICK_AVATARS A filter flag. Include avatars when intersecting. Read-only..
- * @property {number} PICK_HUD A filter flag. Include the HUD sphere when intersecting in HMD mode. Read-only..
+ * @property {FilterFlags} PICK_ENTITIES - Include domain and avatar entities when intersecting. Read-only.
+ *
Deprecated: Use PICK_DOMAIN_ENTITIES | PICK_AVATAR_ENTITIES
+ * instead.
+ * @property {FilterFlags} PICK_OVERLAYS - Include local entities when intersecting. Read-only.
+ *
Deprecated: Use PICK_LOCAL_ENTITIES instead.
*
- * @property {number} PICK_INCLUDE_VISIBLE A filter flag. Include visible objects when intersecting. Read-only..
- * @property {number} PICK_INCLUDE_INVISIBLE A filter flag. Include invisible objects when intersecting. Read-only..
+ * @property {FilterFlags} PICK_INCLUDE_VISIBLE - Include visible objects when intersecting. Read-only.
+ *
Warning: Is currently always enabled by default but may not be in the future.
+ * @property {FilterFlags} PICK_INCLUDE_INVISIBLE - Include invisible objects when intersecting. Read-only.
*
- * @property {number} PICK_INCLUDE_COLLIDABLE A filter flag. Include collidable objects when intersecting. Read-only..
- * @property {number} PICK_INCLUDE_NONCOLLIDABLE A filter flag. Include non-collidable objects when intersecting. Read-only..
+ * @property {FilterFlags} PICK_INCLUDE_COLLIDABLE - Include collidable objects when intersecting. Read-only.
+ *
Warning: Is currently always enabled by default but may not be in the future.
+ * @property {FilterFlags} PICK_INCLUDE_NONCOLLIDABLE - Include non-collidable objects when intersecting. Read-only.
*
- * @property {number} PICK_PRECISE A filter flag. Pick against exact meshes. Read-only..
- * @property {number} PICK_COARSE A filter flag. Pick against coarse meshes. Read-only..
+ * @property {FilterFlags} PICK_PRECISE - Pick against exact meshes. Read-only.
+ * @property {FilterFlags} PICK_COARSE - Pick against coarse meshes. Read-only.
*
- * @property {number} PICK_ALL_INTERSECTIONS Read-only..
+ * @property {FilterFlags} PICK_ALL_INTERSECTIONS - If set, returns all intersections instead of just the closest.
+ * Read-only.
+ *
Warning: Not yet implemented.
*
- * @property {number} INTERSECTED_NONE An intersection type. Intersected nothing with the given filter flags. Read-only.
- * @property {number} INTERSECTED_ENTITY An intersection type. Intersected an entity. Read-only.
- * @property {number} INTERSECTED_LOCAL_ENTITY An intersection type. Intersected a local entity.
- * @property {number} INTERSECTED_OVERLAY An intersection type. Intersected an entity (3D Overlays no longer exist). Read-only.
- * @property {number} INTERSECTED_AVATAR An intersection type. Intersected an avatar. Read-only.
- * @property {number} INTERSECTED_HUD An intersection type. Intersected the HUD sphere. Read-only.
- * @property {number} perFrameTimeBudget - The max number of usec to spend per frame updating Pick results.
+ * @property {IntersectionType} INTERSECTED_NONE - Intersected nothing. Read-only.
+ * @property {IntersectionType} INTERSECTED_ENTITY - Intersected an entity. Read-only.
+ * @property {IntersectionType} INTERSECTED_LOCAL_ENTITY - Intersected a local entity. Read-only.
+ * @property {IntersectionType} INTERSECTED_OVERLAY - Intersected a local entity. (3D overlays no longer exist.)
+ * Read-only.
+ *
Deprecated: Use INTERSECTED_LOCAL_ENTITY instead.
+ * @property {IntersectionType} INTERSECTED_AVATAR - Intersected an avatar. Read-only.
+ * @property {IntersectionType} INTERSECTED_HUD - Intersected the HUD sphere. Read-only.
+ *
+ * @property {number} perFrameTimeBudget - The maximum time, in microseconds, to spend per frame updating pick results.
*/
class PickScriptingInterface : public QObject, public Dependency {
@@ -94,163 +104,145 @@ public:
void registerMetaTypes(QScriptEngine* engine);
/**jsdoc
- * Adds a new Pick.
- * Different {@link PickType}s use different properties, and within one PickType, the properties you choose can lead to a wide range of behaviors. For example,
- * with PickType.Ray, depending on which optional parameters you pass, you could create a Static Ray Pick, a Mouse Ray Pick, or a Joint Ray Pick.
- * Picks created with this method always intersect at least visible and collidable things
+ * Creates a new pick. Different {@link PickType}s use different properties, and within one PickType the properties you
+ * choose can lead to a wide range of behaviors. For example, with PickType.Ray, the properties could
+ * configure a mouse ray pick, an avatar head ray pick, or a joint ray pick.
+ *
Warning: Picks created with this method currently always intersect at least visible and collidable
+ * things but this may not always be the case.
* @function Picks.createPick
- * @param {PickType} type A PickType that specifies the method of picking to use
- * @param {Picks.RayPickProperties|Picks.StylusPickProperties|Picks.ParabolaPickProperties|Picks.CollisionPickProperties} properties A PickProperties object, containing all the properties for initializing this Pick
- * @returns {number} The ID of the created Pick. Used for managing the Pick. 0 if invalid.
+ * @param {PickType} type - The type of picking to use.
+ * @param {Picks.RayPickProperties|Picks.ParabolaPickProperties|Picks.StylusPickProperties|Picks.CollisionPickProperties}
+ * properties - Properties of the pick, per the pick type.
+ * @returns {number} The ID of the pick created. 0 if invalid.
*/
// TODO: expand Pointers to be able to be fully configurable with PickFilters
Q_INVOKABLE unsigned int createPick(const PickQuery::PickType type, const QVariant& properties);
/**jsdoc
- * Enables a Pick.
+ * Enables a pick. enabled picks update their pick results.
* @function Picks.enablePick
- * @param {number} uid The ID of the Pick, as returned by {@link Picks.createPick}.
+ * @param {number} id - The ID of the pick.
*/
Q_INVOKABLE void enablePick(unsigned int uid);
/**jsdoc
- * Disables a Pick.
+ * Disables a pick. Disabled picks do not update their pick results.
* @function Picks.disablePick
- * @param {number} uid The ID of the Pick, as returned by {@link Picks.createPick}.
+ * @param {number} id - The ID of the pick.
*/
Q_INVOKABLE void disablePick(unsigned int uid);
/**jsdoc
- * Removes a Pick.
+ * Removes (deletes) a pick.
* @function Picks.removePick
- * @param {number} uid The ID of the Pick, as returned by {@link Picks.createPick}.
+ * @param {number} id - The ID of the pick.
*/
Q_INVOKABLE void removePick(unsigned int uid);
/**jsdoc
- * An intersection result for a Ray Pick.
- *
- * @typedef {object} RayPickResult
- * @property {number} type The intersection type.
- * @property {boolean} intersects If there was a valid intersection (type != INTERSECTED_NONE)
- * @property {Uuid} objectID The ID of the intersected object. Uuid.NULL for the HUD or invalid intersections.
- * @property {number} distance The distance to the intersection point from the origin of the ray.
- * @property {Vec3} intersection The intersection point in world-space.
- * @property {Vec3} surfaceNormal The surface normal at the intersected point. All NANs if type == INTERSECTED_HUD.
- * @property {Variant} extraInfo Additional intersection details when available for Model objects.
- * @property {PickRay} searchRay The PickRay that was used. Valid even if there was no intersection.
- */
-
- /**jsdoc
- * An intersection result for a Stylus Pick.
- *
- * @typedef {object} StylusPickResult
- * @property {number} type The intersection type.
- * @property {boolean} intersects If there was a valid intersection (type != INTERSECTED_NONE)
- * @property {Uuid} objectID The ID of the intersected object. Uuid.NULL for the HUD or invalid intersections.
- * @property {number} distance The distance to the intersection point from the origin of the ray.
- * @property {Vec3} intersection The intersection point in world-space.
- * @property {Vec3} surfaceNormal The surface normal at the intersected point. All NANs if type == INTERSECTED_HUD.
- * @property {Variant} extraInfo Additional intersection details when available for Model objects.
- * @property {StylusTip} stylusTip The StylusTip that was used. Valid even if there was no intersection.
- */
-
- /**jsdoc
- * An intersection result for a Parabola Pick.
- *
- * @typedef {object} ParabolaPickResult
- * @property {number} type The intersection type.
- * @property {boolean} intersects If there was a valid intersection (type != INTERSECTED_NONE)
- * @property {Uuid} objectID The ID of the intersected object. Uuid.NULL for the HUD or invalid intersections.
- * @property {number} distance The distance to the intersection point from the origin of the parabola, not along the parabola.
- * @property {number} parabolicDistance The distance to the intersection point from the origin of the parabola, along the parabola.
- * @property {Vec3} intersection The intersection point in world-space.
- * @property {Vec3} surfaceNormal The surface normal at the intersected point. All NANs if type == INTERSECTED_HUD.
- * @property {Variant} extraInfo Additional intersection details when available for Model objects.
- * @property {PickParabola} parabola The PickParabola that was used. Valid even if there was no intersection.
- */
-
- /**jsdoc
- * An intersection result for a Collision Pick.
- *
- * @typedef {object} CollisionPickResult
- * @property {boolean} intersects If there was at least one valid intersection (intersectingObjects.length > 0)
- * @property {IntersectingObject[]} intersectingObjects The collision information of each object which intersect with the CollisionRegion.
- * @property {CollisionRegion} collisionRegion The CollisionRegion that was used. Valid even if there was no intersection.
- */
-
- /**jsdoc
- * Information about the Collision Pick's intersection with an object
- *
- * @typedef {object} IntersectingObject
- * @property {QUuid} id The ID of the object.
- * @property {number} type The type of the object, either Picks.INTERSECTED_ENTITY() or Picks.INTERSECTED_AVATAR()
- * @property {CollisionContact[]} collisionContacts Pairs of points representing penetration information between the pick and the object
- */
-
- /**jsdoc
- * A pair of points that represents part of an overlap between a Collision Pick and an object in the physics engine. Points which are further apart represent deeper overlap
- *
- * @typedef {object} CollisionContact
- * @property {Vec3} pointOnPick A point representing a penetration of the object's surface into the volume of the pick, in world space.
- * @property {Vec3} pointOnObject A point representing a penetration of the pick's surface into the volume of the found object, in world space.
- * @property {Vec3} normalOnPick The normalized vector pointing away from the pick, representing the direction of collision.
- */
-
- /**jsdoc
- * Get the most recent pick result from this Pick. This will be updated as long as the Pick is enabled.
+ * Gets the most recent result from a pick. A pick continues to be updated ready to return a result, as long as it is
+ * enabled.
+ *
Note: Stylus picks only intersect with objects in their include list, set using
+ * {@link Picks.setIncludeItems|setIncludeItems}.
* @function Picks.getPrevPickResult
- * @param {number} uid The ID of the Pick, as returned by {@link Picks.createPick}.
- * @returns {RayPickResult|StylusPickResult|ParabolaPickResult|CollisionPickResult} The most recent intersection result. This will be different for different PickTypes.
+ * @param {number} id - The ID of the pick.
+ * @returns {RayPickResult|ParabolaPickResult|StylusPickResult|CollisionPickResult} The most recent intersection result.
+ * @example
Highlight entities under your mouse in desktop mode or that you're looking at in HMD mode.
+ * // Highlight.
+ * var HIGHLIGHT_LIST_NAME = "highlightEntitiesExampleList";
+ * var HIGHLIGHT_LIST_TYPE = "entity";
+ * Selection.enableListHighlight(HIGHLIGHT_LIST_NAME, {});
+ *
+ * // Ray pick.
+ * var PICK_FILTER = Picks.PICK_DOMAIN_ENTITIES | Picks.PICK_AVATAR_ENTITIES
+ * | Picks.PICK_INCLUDE_COLLIDABLE | Picks.PICK_INCLUDE_NONCOLLIDABLE;
+ * var rayPick = Picks.createPick(PickType.Ray, {
+ * enabled: true,
+ * filter: PICK_FILTER,
+ * joint: HMD.active ? "Avatar" : "Mouse"
+ * });
+ *
+ * // Highlight intersected entity.
+ * var highlightedEntityID = null;
+ * Script.update.connect(function () {
+ * var rayPickResult = Picks.getPrevPickResult(rayPick);
+ * if (rayPickResult.intersects) {
+ * if (rayPickResult.objectID !== highlightedEntityID) {
+ * if (highlightedEntityID) {
+ * Selection.removeFromSelectedItemsList(HIGHLIGHT_LIST_NAME, HIGHLIGHT_LIST_TYPE, highlightedEntityID);
+ * }
+ * highlightedEntityID = rayPickResult.objectID;
+ * Selection.addToSelectedItemsList(HIGHLIGHT_LIST_NAME, HIGHLIGHT_LIST_TYPE, highlightedEntityID);
+ * }
+ * } else {
+ * if (highlightedEntityID) {
+ * Selection.removeFromSelectedItemsList(HIGHLIGHT_LIST_NAME, HIGHLIGHT_LIST_TYPE, highlightedEntityID);
+ * highlightedEntityID = null;
+ * }
+ * }
+ * });
+ *
+ * // Clean up.
+ * Script.scriptEnding.connect(function () {
+ * if (highlightedEntityID) {
+ * Selection.removeFromSelectedItemsList(HIGHLIGHT_LIST_NAME, HIGHLIGHT_LIST_TYPE, highlightedEntityID);
+ * }
+ * });
*/
Q_INVOKABLE QVariantMap getPrevPickResult(unsigned int uid);
/**jsdoc
- * Sets whether or not to use precision picking.
+ * Sets whether or not to use precision picking, i.e., whether to pick against precise meshes or coarse meshes.
+ * This has the same effect as using the PICK_PRECISE or PICK_COARSE filter flags.
* @function Picks.setPrecisionPicking
- * @param {number} uid The ID of the Pick, as returned by {@link Picks.createPick}.
- * @param {boolean} precisionPicking Whether or not to use precision picking
+ * @param {number} id - The ID of the pick.
+ * @param {boolean} precisionPicking - true to use precision picking, false to use coarse picking.
*/
Q_INVOKABLE void setPrecisionPicking(unsigned int uid, bool precisionPicking);
/**jsdoc
- * Sets a list of Entity IDs and/or Avatar IDs to ignore during intersection. Not used by Stylus Picks.
+ * Sets a list of entity and avatar IDs to ignore during intersection.
+ *
Note: Not used by stylus picks.
* @function Picks.setIgnoreItems
- * @param {number} uid The ID of the Pick, as returned by {@link Picks.createPick}.
- * @param {Uuid[]} ignoreItems A list of IDs to ignore.
+ * @param {number} id - The ID of the pick.
+ * @param {Uuid[]} ignoreItems - The list of IDs to ignore.
*/
Q_INVOKABLE void setIgnoreItems(unsigned int uid, const QScriptValue& ignoreItems);
/**jsdoc
- * Sets a list of Entity IDs and/or Avatar IDs to include during intersection, instead of intersecting with everything. Stylus
- * Picks only intersect with objects in their include list.
+ * Sets a list of entity IDs and/or avatar IDs to include during intersection, instead of intersecting with everything.
+ *
Note: Stylus picks only intersect with objects in their include list.
* @function Picks.setIncludeItems
- * @param {number} uid The ID of the Pick, as returned by {@link Picks.createPick}.
- * @param {Uuid[]} includeItems A list of IDs to include.
+ * @param {number} id - The ID of the pick.
+ * @param {Uuid[]} includeItems - The list of IDs to include.
*/
Q_INVOKABLE void setIncludeItems(unsigned int uid, const QScriptValue& includeItems);
/**jsdoc
- * Check if a Pick is associated with the left hand.
+ * Checks if a pick is associated with the left hand: a ray or parabola pick with joint set to
+ * "_CONTROLLER_LEFTHAND" or "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND", or a stylus pick with hand
+ * set to 0.
* @function Picks.isLeftHand
- * @param {number} uid The ID of the Pick, as returned by {@link Picks.createPick}.
- * @returns {boolean} True if the Pick is a Joint Ray or Parabola Pick with joint == "_CONTROLLER_LEFTHAND" or "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND", or a Stylus Pick with hand == 0.
+ * @param {number} id - The ID of the pick.
+ * @returns {boolean} true if the pick is associated with the left hand, false if it isn't.
*/
Q_INVOKABLE bool isLeftHand(unsigned int uid);
/**jsdoc
- * Check if a Pick is associated with the right hand.
+ * Checks if a pick is associated with the right hand: a ray or parabola pick with joint set to
+ * "_CONTROLLER_RIGHTHAND" or "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND", or a stylus pick with hand
+ * set to 1.
* @function Picks.isRightHand
- * @param {number} uid The ID of the Pick, as returned by {@link Picks.createPick}.
- * @returns {boolean} True if the Pick is a Joint Ray or Parabola Pick with joint == "_CONTROLLER_RIGHTHAND" or "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND", or a Stylus Pick with hand == 1.
+ * @param {number} id - The ID of the pick.
+ * @returns {boolean} true if the pick is associated with the right hand, false if it isn't.
*/
Q_INVOKABLE bool isRightHand(unsigned int uid);
/**jsdoc
- * Check if a Pick is associated with the system mouse.
+ * Checks if a pick is associated with the system mouse: a ray or parabola pick with joint set to "Mouse".
* @function Picks.isMouse
- * @param {number} uid The ID of the Pick, as returned by {@link Picks.createPick}.
- * @returns {boolean} True if the Pick is a Mouse Ray or Parabola Pick, false otherwise.
+ * @param {number} id - The ID of the pick.
+ * @returns {boolean} true if the pick is associated with the system mouse, false if it isn't.
*/
Q_INVOKABLE bool isMouse(unsigned int uid);
@@ -261,112 +253,145 @@ public slots:
/**jsdoc
* @function Picks.PICK_ENTITIES
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int PICK_ENTITIES() { return PickFilter::getBitMask(PickFilter::FlagBit::DOMAIN_ENTITIES) | PickFilter::getBitMask(PickFilter::FlagBit::AVATAR_ENTITIES); }
+
/**jsdoc
* @function Picks.PICK_OVERLAYS
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int PICK_OVERLAYS() { return PickFilter::getBitMask(PickFilter::FlagBit::LOCAL_ENTITIES); }
+
/**jsdoc
* @function Picks.PICK_DOMAIN_ENTITIES
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int PICK_DOMAIN_ENTITIES() { return PickFilter::getBitMask(PickFilter::FlagBit::DOMAIN_ENTITIES); }
+
/**jsdoc
* @function Picks.PICK_AVATAR_ENTITIES
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int PICK_AVATAR_ENTITIES() { return PickFilter::getBitMask(PickFilter::FlagBit::AVATAR_ENTITIES); }
+
/**jsdoc
* @function Picks.PICK_LOCAL_ENTITIES
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int PICK_LOCAL_ENTITIES() { return PickFilter::getBitMask(PickFilter::FlagBit::LOCAL_ENTITIES); }
+
/**jsdoc
* @function Picks.PICK_AVATARS
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int PICK_AVATARS() { return PickFilter::getBitMask(PickFilter::FlagBit::AVATARS); }
+
/**jsdoc
* @function Picks.PICK_HUD
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int PICK_HUD() { return PickFilter::getBitMask(PickFilter::FlagBit::HUD); }
+
/**jsdoc
* @function Picks.PICK_INCLUDE_VISIBLE
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int PICK_INCLUDE_VISIBLE() { return PickFilter::getBitMask(PickFilter::FlagBit::VISIBLE); }
+
/**jsdoc
* @function Picks.PICK_INCLUDE_INVISIBLE
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int PICK_INCLUDE_INVISIBLE() { return PickFilter::getBitMask(PickFilter::FlagBit::INVISIBLE); }
+
/**jsdoc
* @function Picks.PICK_INCLUDE_COLLIDABLE
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int PICK_INCLUDE_COLLIDABLE() { return PickFilter::getBitMask(PickFilter::FlagBit::COLLIDABLE); }
+
/**jsdoc
* @function Picks.PICK_INCLUDE_NONCOLLIDABLE
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int PICK_INCLUDE_NONCOLLIDABLE() { return PickFilter::getBitMask(PickFilter::FlagBit::NONCOLLIDABLE); }
+
/**jsdoc
* @function Picks.PICK_PRECISE
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int PICK_PRECISE() { return PickFilter::getBitMask(PickFilter::FlagBit::PRECISE); }
+
/**jsdoc
* @function Picks.PICK_COARSE
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int PICK_COARSE() { return PickFilter::getBitMask(PickFilter::FlagBit::COARSE); }
+
/**jsdoc
* @function Picks.PICK_ALL_INTERSECTIONS
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int PICK_ALL_INTERSECTIONS() { return PickFilter::getBitMask(PickFilter::FlagBit::PICK_ALL_INTERSECTIONS); }
/**jsdoc
* @function Picks.INTERSECTED_NONE
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int INTERSECTED_NONE() { return IntersectionType::NONE; }
/**jsdoc
* @function Picks.INTERSECTED_ENTITY
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int INTERSECTED_ENTITY() { return IntersectionType::ENTITY; }
/**jsdoc
- * @function Picks.INTERSECTED_OVERLAY
+ * @function Picks.INTERSECTED_LOCAL_ENTITY
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int INTERSECTED_LOCAL_ENTITY() { return IntersectionType::LOCAL_ENTITY; }
/**jsdoc
* @function Picks.INTERSECTED_OVERLAY
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int INTERSECTED_OVERLAY() { return INTERSECTED_LOCAL_ENTITY(); }
/**jsdoc
* @function Picks.INTERSECTED_AVATAR
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int INTERSECTED_AVATAR() { return IntersectionType::AVATAR; }
/**jsdoc
* @function Picks.INTERSECTED_HUD
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static constexpr unsigned int INTERSECTED_HUD() { return IntersectionType::HUD; }
diff --git a/interface/src/raypick/PointerScriptingInterface.h b/interface/src/raypick/PointerScriptingInterface.h
index b04d15d888..268b178fb6 100644
--- a/interface/src/raypick/PointerScriptingInterface.h
+++ b/interface/src/raypick/PointerScriptingInterface.h
@@ -49,7 +49,7 @@ public:
* with PickType.Ray, depending on which optional parameters you pass, you could create a Static Ray Pointer, a Mouse Ray Pointer, or a Joint Ray Pointer.
* Pointers created with this method always intersect at least visible and collidable things
* @function Pointers.createPointer
- * @param {PickType} type A PickType that specifies the method of picking to use
+ * @param {PickType} type A PickType that specifies the method of picking to use. Cannot be {@link PickType|PickType.Collision}.
* @param {Pointers.LaserPointerProperties|Pointers.StylusPointerProperties|Pointers.ParabolaPointerProperties} properties A PointerProperties object, containing all the properties for initializing this Pointer and the {@link Picks.PickProperties} for the Pick that
* this Pointer will use to do its picking.
* @returns {number} The ID of the created Pointer. Used for managing the Pointer. 0 if invalid.
diff --git a/interface/src/raypick/RayPick.h b/interface/src/raypick/RayPick.h
index 161c930fef..170a0489da 100644
--- a/interface/src/raypick/RayPick.h
+++ b/interface/src/raypick/RayPick.h
@@ -39,6 +39,21 @@ public:
float distance { FLT_MAX };
bool intersects { false };
+ /**jsdoc
+ * An intersection result for a ray pick.
+ *
+ * @typedef {object} RayPickResult
+ * @property {IntersectionType} type - The intersection type.
+ * @property {boolean} intersects - true if there's a valid intersection, false if there isn't.
+ * @property {Uuid} objectID - The ID of the intersected object. null for HUD or invalid intersections.
+ * @property {number} distance - The distance from the ray origin to the intersection point.
+ * @property {Vec3} intersection - The intersection point in world coordinates.
+ * @property {Vec3} surfaceNormal - The surface normal at the intersected point. All NaNs if type ==
+ * Picks.INTERSECTED_HUD.
+ * @property {SubmeshIntersection} extraInfo - Additional intersection details for model objects, otherwise
+ * { }.
+ * @property {PickRay} searchRay - The pick ray that was used. Valid even if there is no intersection.
+ */
virtual QVariantMap toVariantMap() const override {
QVariantMap toReturn;
toReturn["type"] = type;
diff --git a/interface/src/raypick/RayPickScriptingInterface.h b/interface/src/raypick/RayPickScriptingInterface.h
index 64b21ea055..32b2b8fb68 100644
--- a/interface/src/raypick/RayPickScriptingInterface.h
+++ b/interface/src/raypick/RayPickScriptingInterface.h
@@ -19,29 +19,32 @@
#include "PickScriptingInterface.h"
/**jsdoc
- * Synonym for {@link Picks} as used for ray picks. Deprecated.
+ * The RayPick API is a subset of the {@link Picks} API, as used for ray picks.
*
* @namespace RayPick
*
+ * @deprecated This API is deprecated and will be removed. Use the {@link Picks} API instead.
+ *
* @hifi-interface
* @hifi-client-entity
* @hifi-avatar
*
- * @property {number} PICK_ENTITIES Read-only.
- * @property {number} PICK_OVERLAYS Read-only.
- * @property {number} PICK_AVATARS Read-only.
- * @property {number} PICK_HUD Read-only.
- * @property {number} PICK_COARSE Read-only.
- * @property {number} PICK_INCLUDE_INVISIBLE Read-only.
- * @property {number} PICK_INCLUDE_NONCOLLIDABLE Read-only.
- * @property {number} PICK_ALL_INTERSECTIONS Read-only.
- * @property {number} INTERSECTED_NONE Read-only.
- * @property {number} INTERSECTED_ENTITY Read-only.
- * @property {number} INTERSECTED_OVERLAY Read-only.
- * @property {number} INTERSECTED_AVATAR Read-only.
- * @property {number} INTERSECTED_HUD Read-only.
+ * @property {FilterFlags} PICK_ENTITIES - Include domain and avatar entities when intersecting.
+ * Read-only.
+ * @property {FilterFlags} PICK_OVERLAYS - Include local entities when intersecting. Read-only.
+ * @property {FilterFlags} PICK_AVATARS - Include avatars when intersecting. Read-only.
+ * @property {FilterFlags} PICK_HUD - Include the HUD sphere when intersecting in HMD mode. Read-only.
+ * @property {FilterFlags} PICK_PRECISE - Pick against exact meshes. Read-only.
+ * @property {FilterFlags} PICK_INCLUDE_INVISIBLE - Include invisible objects when intersecting. Read-only.
+ * @property {FilterFlags} PICK_INCLUDE_NONCOLLIDABLE - Include non-collidable objects when intersecting. Read-only.
+ * @property {FilterFlags} PICK_ALL_INTERSECTIONS - Return all intersections instead of just the closest. Read-only.
+ * @property {IntersectionType} INTERSECTED_NONE - Intersected nothing with the given filter flags. Read-only.
+ * @property {IntersectionType} INTERSECTED_ENTITY - Intersected an entity. Read-only.
+ * @property {IntersectionType} INTERSECTED_LOCAL_ENTITY - Intersected a local entity. Read-only.
+ * @property {IntersectionType} INTERSECTED_OVERLAY - Intersected an entity (3D Overlays no longer exist). Read-only.
+ * @property {IntersectionType} INTERSECTED_AVATAR - Intersected an avatar. Read-only.
+ * @property {IntersectionType} INTERSECTED_HUD - Intersected the HUD sphere. Read-only.
*/
-
class RayPickScriptingInterface : public QObject, public Dependency {
Q_OBJECT
Q_PROPERTY(unsigned int PICK_ENTITIES READ PICK_ENTITIES CONSTANT)
@@ -63,78 +66,96 @@ class RayPickScriptingInterface : public QObject, public Dependency {
public:
/**jsdoc
+ * Creates a new ray pick.
+ *
Warning: Picks created with this method currently always intersect at least visible and collidable
+ * things but this may not always be the case.
* @function RayPick.createRayPick
- * @param {Picks.RayPickProperties}
- * @returns {number}
+ * @param {Picks.RayPickProperties} properties - Properties of the pick.
+ * @returns {number} The ID of the pick created. 0 if invalid.
*/
Q_INVOKABLE unsigned int createRayPick(const QVariant& properties);
/**jsdoc
+ * Enables a ray pick.
* @function RayPick.enableRayPick
- * @param {number} id
+ * @param {number} id - The ID of the ray pick.
*/
Q_INVOKABLE void enableRayPick(unsigned int uid);
/**jsdoc
+ * Disables a ray pick.
* @function RayPick.disableRayPick
- * @param {number} id
+ * @param {number} id - The ID of the ray pick.
*/
Q_INVOKABLE void disableRayPick(unsigned int uid);
/**jsdoc
+ * Removes (deletes) a ray pick.
* @function RayPick.removeRayPick
- * @param {number} id
+ * @param {number} id - The ID of the ray pick.
*/
Q_INVOKABLE void removeRayPick(unsigned int uid);
/**jsdoc
+ * Gets the most recent pick result from a ray pick. A ray pick continues to be updated ready to return a result, as long
+ * as it is enabled.
* @function RayPick.getPrevRayPickResult
- * @param {number} id
+ * @param {number} id - The ID of the ray pick.
* @returns {RayPickResult}
*/
Q_INVOKABLE QVariantMap getPrevRayPickResult(unsigned int uid);
/**jsdoc
+ * Sets whether or not to use precision picking, i.e., whether to pick against precise meshes or coarse meshes.
* @function RayPick.setPrecisionPicking
- * @param {number} id
- * @param {boolean} precisionPicking
+ * @param {number} id - The ID of the ray pick.
+ * @param {boolean} precisionPicking - true to use precision picking, false to use coarse picking.
*/
Q_INVOKABLE void setPrecisionPicking(unsigned int uid, bool precisionPicking);
/**jsdoc
+ * Sets a list of entity and avatar IDs to ignore during intersection.
* @function RayPick.setIgnoreItems
- * @param {number} id
- * @param {Uuid[]) ignoreEntities
+ * @param {number} id - The ID of the ray pick.
+ * @param {Uuid[]} ignoreItems - The list of IDs to ignore.
*/
Q_INVOKABLE void setIgnoreItems(unsigned int uid, const QScriptValue& ignoreEntities);
/**jsdoc
+ * Sets a list of entity IDs and/or avatar IDs to include during intersection, instead of intersecting with everything.
* @function RayPick.setIncludeItems
- * @param {number} id
- * @param {Uuid[]) includeEntities
+ * @param {number} id - The ID of the ray pick.
+ * @param {Uuid[]} includeItems - The list of IDs to include.
*/
Q_INVOKABLE void setIncludeItems(unsigned int uid, const QScriptValue& includeEntities);
/**jsdoc
+ * Checks if a pick is associated with the left hand: a ray or parabola pick with joint set to
+ * "_CONTROLLER_LEFTHAND" or "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND", or a stylus pick with hand
+ * set to 0.
* @function RayPick.isLeftHand
- * @param {number} id
- * @returns {boolean}
+ * @param {number} id - The ID of the ray pick.
+ * @returns {boolean} true if the pick is associated with the left hand, false if it isn't.
*/
Q_INVOKABLE bool isLeftHand(unsigned int uid);
/**jsdoc
+ * Checks if a pick is associated with the right hand: a ray or parabola pick with joint set to
+ * "_CONTROLLER_RIGHTHAND" or "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND", or a stylus pick with hand
+ * set to 1.
* @function RayPick.isRightHand
- * @param {number} id
- * @returns {boolean}
+ * @param {number} id - The ID of the ray pick.
+ * @returns {boolean} true if the pick is associated with the right hand, false if it isn't.
*/
Q_INVOKABLE bool isRightHand(unsigned int uid);
/**jsdoc
+ * Checks if a pick is associated with the system mouse: a ray or parabola pick with joint set to "Mouse".
* @function RayPick.isMouse
- * @param {number} id
- * @returns {boolean}
+ * @param {number} id - The ID of the ray pick.
+ * @returns {boolean} true if the pick is associated with the system mouse, false if it isn't.
*/
Q_INVOKABLE bool isMouse(unsigned int uid);
@@ -142,84 +163,98 @@ public slots:
/**jsdoc
* @function RayPick.PICK_ENTITIES
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static unsigned int PICK_ENTITIES() { return PickScriptingInterface::PICK_ENTITIES(); }
/**jsdoc
* @function RayPick.PICK_OVERLAYS
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static unsigned int PICK_OVERLAYS() { return PickScriptingInterface::PICK_OVERLAYS(); }
/**jsdoc
* @function RayPick.PICK_AVATARS
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static unsigned int PICK_AVATARS() { return PickScriptingInterface::PICK_AVATARS(); }
/**jsdoc
* @function RayPick.PICK_HUD
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static unsigned int PICK_HUD() { return PickScriptingInterface::PICK_HUD(); }
/**jsdoc
* @function RayPick.PICK_COARSE
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static unsigned int PICK_COARSE() { return PickScriptingInterface::PICK_COARSE(); }
/**jsdoc
* @function RayPick.PICK_INCLUDE_INVISIBLE
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static unsigned int PICK_INCLUDE_INVISIBLE() { return PickScriptingInterface::PICK_INCLUDE_INVISIBLE(); }
/**jsdoc
* @function RayPick.PICK_INCLUDE_NONCOLLIDABLE
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static unsigned int PICK_INCLUDE_NONCOLLIDABLE() { return PickScriptingInterface::PICK_INCLUDE_NONCOLLIDABLE(); }
/**jsdoc
* @function RayPick.PICK_ALL_INTERSECTIONS
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static unsigned int PICK_ALL_INTERSECTIONS() { return PickScriptingInterface::PICK_ALL_INTERSECTIONS(); }
/**jsdoc
* @function RayPick.INTERSECTED_NONE
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static unsigned int INTERSECTED_NONE() { return PickScriptingInterface::INTERSECTED_NONE(); }
/**jsdoc
* @function RayPick.INTERSECTED_ENTITY
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static unsigned int INTERSECTED_ENTITY() { return PickScriptingInterface::INTERSECTED_ENTITY(); }
/**jsdoc
* @function RayPick.INTERSECTED_OVERLAY
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static unsigned int INTERSECTED_LOCAL_ENTITY() { return PickScriptingInterface::INTERSECTED_LOCAL_ENTITY(); }
/**jsdoc
* @function RayPick.INTERSECTED_OVERLAY
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static unsigned int INTERSECTED_OVERLAY() { return PickScriptingInterface::INTERSECTED_LOCAL_ENTITY(); }
/**jsdoc
* @function RayPick.INTERSECTED_AVATAR
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static unsigned int INTERSECTED_AVATAR() { return PickScriptingInterface::INTERSECTED_AVATAR(); }
/**jsdoc
* @function RayPick.INTERSECTED_HUD
+ * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
* @returns {number}
*/
static unsigned int INTERSECTED_HUD() { return PickScriptingInterface::INTERSECTED_HUD(); }
diff --git a/interface/src/raypick/StylusPick.h b/interface/src/raypick/StylusPick.h
index 9d5dc10b67..e443fb1c6d 100644
--- a/interface/src/raypick/StylusPick.h
+++ b/interface/src/raypick/StylusPick.h
@@ -38,6 +38,18 @@ public:
glm::vec3 intersection { NAN };
glm::vec3 surfaceNormal { NAN };
+ /**jsdoc
+ * An intersection result for a stylus pick.
+ *
+ * @typedef {object} StylusPickResult
+ * @property {number} type - The intersection type.
+ * @property {boolean} intersects - true if there's a valid intersection, false if there isn't.
+ * @property {Uuid} objectID - The ID of the intersected object. null for invalid intersections.
+ * @property {number} distance - The distance to the intersection point from the stylus tip.
+ * @property {Vec3} intersection - The intersection point in world coordinates.
+ * @property {Vec3} surfaceNormal - The surface normal at the intersected point.
+ * @property {StylusTip} stylusTip - The stylus tip at the time of the result. Valid even if there is no intersection.
+ */
virtual QVariantMap toVariantMap() const override {
QVariantMap toReturn;
toReturn["type"] = type;
diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp
index 2b738bc4e7..5d39139b46 100644
--- a/libraries/entities/src/EntityItemProperties.cpp
+++ b/libraries/entities/src/EntityItemProperties.cpp
@@ -801,7 +801,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
*
* @property {boolean} collisionless=false - Whether or not the entity should collide with items per its
* collisionMask property. If true then the entity does not collide. A synonym is ignoreForCollisions.
- * @property {Entities.CollisionMask} collisionMask=31 - What types of items the entity should collide with.
+ * @property {CollisionMask} collisionMask=31 - What types of items the entity should collide with.
* @property {string} collidesWith="static,dynamic,kinematic,myAvatar,otherAvatar," - Synonym for collisionMask,
* in text format.
* @property {string} collisionSoundURL="" - The sound to play when the entity experiences a collision. Valid file formats are
diff --git a/libraries/pointers/src/Pick.h b/libraries/pointers/src/Pick.h
index dda35a53a2..1766736664 100644
--- a/libraries/pointers/src/Pick.h
+++ b/libraries/pointers/src/Pick.h
@@ -20,6 +20,22 @@
#include
#include
+/**jsdoc
+ *
The type of an intersection.
+ *
+ *
+ *
Name
Value
Description
+ *
+ *
+ *
INTERSECTED_NONE
0
Intersected nothing.
+ *
INTERSECTED_ENTITY
1
Intersected an entity.
+ *
INTERSECTED_LOCAL_ENTITY
2
Intersected a local entity.
+ *
INTERSECTED_AVATAR
3
Intersected an avatar.
+ *
INTERSECTED_HUD
4
Intersected the HUD sphere.
+ *
+ *
+ * @typedef {number} IntersectionType
+ */
enum IntersectionType {
NONE = 0,
ENTITY,
@@ -61,7 +77,7 @@ public:
virtual ~PickQuery() = default;
/**jsdoc
- * Enum for different types of Picks and Pointers.
+ * The PickType API provides constant numeric values that represent different types of picks.
*
* @namespace PickType
* @variation 0
@@ -70,22 +86,28 @@ public:
* @hifi-client-entity
* @hifi-avatar
*
- * @property {number} Ray Ray picks intersect a ray with the nearest object in front of them, along a given direction.
- * @property {number} Stylus Stylus picks provide "tapping" functionality on/into flat surfaces.
- * @property {number} Parabola Parabola picks intersect a parabola with the nearest object in front of them, with a given
- * initial velocity and acceleration.
- * @property {number} Collision Collision picks intersect a collision volume with avatars and entities that have collisions.
+ * @property {number} Ray - Ray picks intersect a ray with objects in front of them, along their direction.
+ * @property {number} Parabola - Parabola picks intersect a parabola with objects in front of them, along their arc.
+ * @property {number} Stylus - Stylus picks provide "tapping" functionality on or into flat surfaces.
+ * @property {number} Collision - Collision picks intersect a collision volume with avatars and entities that have
+ * collisions.
*/
- /**jsdoc
+
+ /**jsdoc
+ *
A type of pick.
*
*
*
Value
Description
*
*
- *
{@link PickType(0)|PickType.Ray}
- *
{@link PickType(0)|PickType.Stylus}
- *
{@link PickType(0)|PickType.Parabola}
- *
{@link PickType(0)|PickType.Collision}
+ *
{@link PickType(0)|PickType.Ray}
Ray picks intersect a ray with objects in front of
+ * them, along their direction.
+ *
{@link PickType(0)|PickType.Parabola}
Parabola picks intersect a parabola with objects
+ * in front of them, along their arc.
+ *
{@link PickType(0)|PickType.Stylus}
Stylus picks provide "tapping" functionality on or
+ * into flat surfaces.
+ *
{@link PickType(0)|PickType.Collision}
Collision picks intersect a collision volume
+ * with avatars and entities that have collisions.
*
*
* @typedef {number} PickType
diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp
index e2d78a8d94..9d24b8e706 100644
--- a/libraries/render-utils/src/Model.cpp
+++ b/libraries/render-utils/src/Model.cpp
@@ -445,7 +445,7 @@ bool Model::findRayIntersectionAgainstSubMeshes(const glm::vec3& origin, const g
}
/**jsdoc
- * Information about a submesh intersection point.
+ * 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.
diff --git a/libraries/shared/src/PhysicsCollisionGroups.h b/libraries/shared/src/PhysicsCollisionGroups.h
index be641b5cd2..7323133876 100644
--- a/libraries/shared/src/PhysicsCollisionGroups.h
+++ b/libraries/shared/src/PhysicsCollisionGroups.h
@@ -72,7 +72,7 @@ const int32_t BULLET_COLLISION_MASK_DETAILED_RAY = BULLET_COLLISION_GROUP_DETAIL
const int32_t BULLET_COLLISION_MASK_COLLISIONLESS = 0;
/**jsdoc
- *
An entity may collide with the following types of items:
+ *
A collision may be with the following types of items:
The values for the collision types that are enabled are added together to give the CollisionMask value. For example, a
* value of 31 means that an entity will collide with all item types.
- * @typedef {number} Entities.CollisionMask
+ * @typedef {number} CollisionMask
*/
// The USER collision groups are exposed to script and can be used to generate per-object collision masks.
diff --git a/libraries/shared/src/PickFilter.h b/libraries/shared/src/PickFilter.h
index 33f6e7278a..8c1c4f56f6 100644
--- a/libraries/shared/src/PickFilter.h
+++ b/libraries/shared/src/PickFilter.h
@@ -13,6 +13,34 @@
class PickFilter {
public:
+
+ /**jsdoc
+ *
A set of flags for a pick filter. The value is constructed by using the | (bitwise OR) operator on the
+ * individual flag values.
+ *
+ *
+ *
Flag name
Value
Description
+ *
+ *
+ *
PICK_DOMAIN_ENTITIES
1
Include domain entities when intersecting.
+ *
PICK_AVATAR_ENTITIES
2
Include avatar entities when intersecting.
+ *
PICK_LOCAL_ENTITIES
4
Include local entities when intersecting.
+ *
PICK_AVATATRS
8
Include avatars when intersecting.
+ *
PICK_HUD
16
Include the HUD sphere when intersecting in HMD mode.
+ *
PICK_INCLUDE_VISIBLE
32
Include visible objects when intersecting.
+ *
PICK_INCLUDE_INVISIBLE
64
Include invisible objects when intersecting.
+ *
PICK_INCLUDE_COLLIDABLE
128
Include collidable objects when
+ * intersecting.
+ *
PICK_INCLUDE_NONCOLLIDABLE
256
Include non-collidable objects when
+ * intersecting.
+ *
PICK_PRECISE
512
Pick against exact meshes.
+ *
PICK_COARSE
1024
Pick against coarse meshes.
+ *
PICK_ALL_INTERSECTIONS
2048
Return all intersections instead of just the
+ * closest.
+ *
+ *
+ * @typedef {number} FilterFlags
+ */
enum FlagBit {
DOMAIN_ENTITIES = 0,
AVATAR_ENTITIES,
diff --git a/libraries/shared/src/RegisteredMetaTypes.h b/libraries/shared/src/RegisteredMetaTypes.h
index d3fb816f3c..ef2d775eec 100644
--- a/libraries/shared/src/RegisteredMetaTypes.h
+++ b/libraries/shared/src/RegisteredMetaTypes.h
@@ -258,12 +258,12 @@ public:
};
/**jsdoc
- * A PickRay defines a vector with a starting point. It is used, for example, when finding entities or avatars that lie under a
- * mouse click or intersect a laser beam.
+ * A vector with a starting point. It is used, for example, when finding entities or avatars that lie under a mouse click or
+ * intersect a laser beam.
*
* @typedef {object} PickRay
- * @property {Vec3} origin - The starting position of the PickRay.
- * @property {Vec3} direction - The direction that the PickRay travels.
+ * @property {Vec3} origin - The starting position of the ray.
+ * @property {Vec3} direction - The direction that the ray travels.
*/
class PickRay : public MathPick {
public:
@@ -291,13 +291,14 @@ QScriptValue pickRayToScriptValue(QScriptEngine* engine, const PickRay& pickRay)
void pickRayFromScriptValue(const QScriptValue& object, PickRay& pickRay);
/**jsdoc
- * A StylusTip defines the tip of a stylus.
+ * The tip of a stylus.
*
* @typedef {object} StylusTip
- * @property {number} side - The hand the tip is attached to: 0 for left, 1 for right.
- * @property {Vec3} tipOffset - the position offset of the stylus tip.
+ * @property {number} side - The hand that the stylus is attached to: 0 for left hand, 1 for the
+ * right hand, -1 for invalid.
+ * @property {Vec3} tipOffset - The position of the stylus tip relative to the body of the stylus.
* @property {Vec3} position - The position of the stylus tip.
- * @property {Quat} orientation - The orientation of the stylus tip.
+ * @property {Quat} orientation - The orientation of the stylus.
* @property {Vec3} velocity - The velocity of the stylus tip.
*/
class StylusTip : public MathPick {
@@ -333,12 +334,16 @@ public:
};
/**jsdoc
-* A PickParabola defines a parabola with a starting point, intitial velocity, and acceleration.
+* A parabola defined by a starting point, initial velocity, and acceleration. It is used, for example, when finding entities or
+* avatars that intersect a parabolic beam.
*
* @typedef {object} PickParabola
-* @property {Vec3} origin - The starting position of the PickParabola.
-* @property {Vec3} velocity - The starting velocity of the parabola.
-* @property {Vec3} acceleration - The acceleration that the parabola experiences.
+* @property {Vec3} origin - The starting position of the parabola, i.e., the initial position of a virtual projectile whose
+* trajectory defines the parabola.
+* @property {Vec3} velocity - The starting velocity of the parabola in m/s, i.e., the initial speed of a virtual projectile
+* whose trajectory defines the parabola.
+* @property {Vec3} acceleration - The acceleration that the parabola experiences in m/s2, i.e., the acceleration of
+* a virtual projectile whose trajectory defines the parabola, both magnitude and direction.
*/
class PickParabola : public MathPick {
public:
@@ -364,23 +369,6 @@ public:
}
};
-// TODO: Add "loaded" to CollisionRegion jsdoc once model collision picks are supported.
-
-/**jsdoc
-* A CollisionRegion defines a volume for checking collisions in the physics simulation.
-
-* @typedef {object} CollisionRegion
-* @property {Shape} shape - The information about the collision region's size and shape. Dimensions are in world space, but will scale with the parent if defined.
-* @property {Vec3} position - The position of the collision region, relative to a parent if defined.
-* @property {Quat} orientation - The orientation of the collision region, relative to a parent if defined.
-* @property {float} threshold - The approximate minimum penetration depth for a test object to be considered in contact with the collision region.
-* The depth is measured in world space, but will scale with the parent if defined.
-* @property {CollisionMask} [collisionGroup=8] - The type of object this collision pick collides as. Objects whose collision masks overlap with the pick's collision group
-* will be considered colliding with the pick.
-* @property {Uuid} parentID - The ID of the parent, either an avatar or an entity.
-* @property {number} parentJointIndex - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint)
-* @property {string} joint - If "Mouse," parents the pick to the mouse. If "Avatar," parents the pick to MyAvatar's head. Otherwise, parents to the joint of the given name on MyAvatar.
-*/
class CollisionRegion : public MathPick {
public:
CollisionRegion() { }
@@ -435,6 +423,29 @@ public:
}
}
+ /**jsdoc
+ * A volume for checking collisions in the physics simulation.
+ * @typedef {object} CollisionRegion
+ * @property {Shape} shape - The collision region's shape and size. Dimensions are in world space, but scale with the parent
+ * if defined.
+ * @property {boolean} loaded - true if the shape has no model, or has a model and it is loaded.
+ * @property {Vec3} position - The position of the collision region, relative to the parent if defined.
+ * @property {Quat} orientation - The orientation of the collision region, relative to the parent if defined.
+ * @property {number} threshold - The approximate minimum penetration depth for a test object to be considered in contact with
+ * the collision region. The depth is in world coordinates but scales with the parent if defined.
+ * @property {CollisionMask} [collisionGroup=8] - The type of objects the collision region collides as. Objects whose collision
+ * masks overlap with the regions's collision group are considered to be colliding with the region.
+ */
+
+ /**jsdoc
+ * A physical volume.
+ * @typedef {object} Shape
+ * @property {ShapeType} shapeType="none" - The type of shape.
+ * @property {string} [modelUrl=""] - The model to load to for the shape if shapeType is one of
+ * "compound", "simple-hull", "simple-compound", or "static-mesh".
+ * @property {Vec3} dimensions - The dimensions of the shape.
+ */
+
QVariantMap toVariantMap() const override {
QVariantMap collisionRegion;
@@ -589,7 +600,7 @@ namespace std {
}
/**jsdoc
- *
From 65f9099ea53df06d72aa94917372c70ba2680c1a Mon Sep 17 00:00:00 2001
From: David Rowe
Date: Thu, 25 Apr 2019 19:29:17 +1200
Subject: [PATCH 02/11] Fix up deprecated notices
---
.../src/raypick/PickScriptingInterface.h | 67 ++++++++++++-------
.../src/raypick/RayPickScriptingInterface.h | 37 ++++++----
2 files changed, 66 insertions(+), 38 deletions(-)
diff --git a/interface/src/raypick/PickScriptingInterface.h b/interface/src/raypick/PickScriptingInterface.h
index e544262b5f..b85249b599 100644
--- a/interface/src/raypick/PickScriptingInterface.h
+++ b/interface/src/raypick/PickScriptingInterface.h
@@ -32,10 +32,11 @@
* @property {FilterFlags} PICK_HUD - Include the HUD sphere when intersecting in HMD mode. Read-only.
*
* @property {FilterFlags} PICK_ENTITIES - Include domain and avatar entities when intersecting. Read-only.
- *
Deprecated: Use PICK_DOMAIN_ENTITIES | PICK_AVATAR_ENTITIES
- * instead.
+ *
Deprecated: This property is deprecated and will be removed. Use PICK_DOMAIN_ENTITIES |
+ * PICK_AVATAR_ENTITIES instead.
* @property {FilterFlags} PICK_OVERLAYS - Include local entities when intersecting. Read-only.
- *
Deprecated: Use PICK_LOCAL_ENTITIES instead.
+ *
Deprecated: This property is deprecated and will be removed. Use PICK_LOCAL_ENTITIES
+ * instead.
*
* @property {FilterFlags} PICK_INCLUDE_VISIBLE - Include visible objects when intersecting. Read-only.
*
Warning: Is currently always enabled by default but may not be in the future.
@@ -57,7 +58,8 @@
* @property {IntersectionType} INTERSECTED_LOCAL_ENTITY - Intersected a local entity. Read-only.
* @property {IntersectionType} INTERSECTED_OVERLAY - Intersected a local entity. (3D overlays no longer exist.)
* Read-only.
- *
Deprecated: Use INTERSECTED_LOCAL_ENTITY instead.
+ *
Deprecated: This property is deprecated and will be removed. Use
+ * INTERSECTED_LOCAL_ENTITY instead.
* @property {IntersectionType} INTERSECTED_AVATAR - Intersected an avatar. Read-only.
* @property {IntersectionType} INTERSECTED_HUD - Intersected the HUD sphere. Read-only.
*
@@ -253,14 +255,16 @@ public slots:
/**jsdoc
* @function Picks.PICK_ENTITIES
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.PICK_DOMAIN_ENTITIES |
+ * Picks.PICK_AVATAR_ENTITIES properties expression instead.
* @returns {number}
*/
static constexpr unsigned int PICK_ENTITIES() { return PickFilter::getBitMask(PickFilter::FlagBit::DOMAIN_ENTITIES) | PickFilter::getBitMask(PickFilter::FlagBit::AVATAR_ENTITIES); }
/**jsdoc
* @function Picks.PICK_OVERLAYS
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.PICK_LOCAL_ENTITIES property
+ * instead.
* @returns {number}
*/
static constexpr unsigned int PICK_OVERLAYS() { return PickFilter::getBitMask(PickFilter::FlagBit::LOCAL_ENTITIES); }
@@ -268,35 +272,39 @@ public slots:
/**jsdoc
* @function Picks.PICK_DOMAIN_ENTITIES
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.PICK_DOMAIN_ENTITIES property
+ * instead.
* @returns {number}
*/
static constexpr unsigned int PICK_DOMAIN_ENTITIES() { return PickFilter::getBitMask(PickFilter::FlagBit::DOMAIN_ENTITIES); }
/**jsdoc
* @function Picks.PICK_AVATAR_ENTITIES
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.PICK_AVATAR_ENTITIES property
+ * instead.
* @returns {number}
*/
static constexpr unsigned int PICK_AVATAR_ENTITIES() { return PickFilter::getBitMask(PickFilter::FlagBit::AVATAR_ENTITIES); }
/**jsdoc
* @function Picks.PICK_LOCAL_ENTITIES
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.PICK_LOCAL_ENTITIES property
+ * instead.
* @returns {number}
*/
static constexpr unsigned int PICK_LOCAL_ENTITIES() { return PickFilter::getBitMask(PickFilter::FlagBit::LOCAL_ENTITIES); }
/**jsdoc
* @function Picks.PICK_AVATARS
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.PICK_AVATARS property
+ * instead.
* @returns {number}
*/
static constexpr unsigned int PICK_AVATARS() { return PickFilter::getBitMask(PickFilter::FlagBit::AVATARS); }
/**jsdoc
* @function Picks.PICK_HUD
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.PICK_HUD property instead.
* @returns {number}
*/
static constexpr unsigned int PICK_HUD() { return PickFilter::getBitMask(PickFilter::FlagBit::HUD); }
@@ -304,14 +312,16 @@ public slots:
/**jsdoc
* @function Picks.PICK_INCLUDE_VISIBLE
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.PICK_INCLUDE_VISIBLE property
+ * instead.
* @returns {number}
*/
static constexpr unsigned int PICK_INCLUDE_VISIBLE() { return PickFilter::getBitMask(PickFilter::FlagBit::VISIBLE); }
/**jsdoc
* @function Picks.PICK_INCLUDE_INVISIBLE
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.PICK_INCLUDE_INVISIBLE property
+ * instead.
* @returns {number}
*/
static constexpr unsigned int PICK_INCLUDE_INVISIBLE() { return PickFilter::getBitMask(PickFilter::FlagBit::INVISIBLE); }
@@ -319,14 +329,16 @@ public slots:
/**jsdoc
* @function Picks.PICK_INCLUDE_COLLIDABLE
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.PICK_INCLUDE_COLLIDABLE property
+ * instead.
* @returns {number}
*/
static constexpr unsigned int PICK_INCLUDE_COLLIDABLE() { return PickFilter::getBitMask(PickFilter::FlagBit::COLLIDABLE); }
/**jsdoc
* @function Picks.PICK_INCLUDE_NONCOLLIDABLE
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.PICK_INCLUDE_NONCOLLIDABLE
+ * property instead.
* @returns {number}
*/
static constexpr unsigned int PICK_INCLUDE_NONCOLLIDABLE() { return PickFilter::getBitMask(PickFilter::FlagBit::NONCOLLIDABLE); }
@@ -334,14 +346,14 @@ public slots:
/**jsdoc
* @function Picks.PICK_PRECISE
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.PICK_PRECISE property instead.
* @returns {number}
*/
static constexpr unsigned int PICK_PRECISE() { return PickFilter::getBitMask(PickFilter::FlagBit::PRECISE); }
/**jsdoc
* @function Picks.PICK_COARSE
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.PICK_COARSE property instead.
* @returns {number}
*/
static constexpr unsigned int PICK_COARSE() { return PickFilter::getBitMask(PickFilter::FlagBit::COARSE); }
@@ -349,49 +361,56 @@ public slots:
/**jsdoc
* @function Picks.PICK_ALL_INTERSECTIONS
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.PICK_ALL_INTERSECTIONS property
+ * instead.
* @returns {number}
*/
static constexpr unsigned int PICK_ALL_INTERSECTIONS() { return PickFilter::getBitMask(PickFilter::FlagBit::PICK_ALL_INTERSECTIONS); }
/**jsdoc
* @function Picks.INTERSECTED_NONE
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.INTERSECTED_NONE property
+ * instead.
* @returns {number}
*/
static constexpr unsigned int INTERSECTED_NONE() { return IntersectionType::NONE; }
/**jsdoc
* @function Picks.INTERSECTED_ENTITY
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.INTERSECTED_ENTITY property
+ * instead.
* @returns {number}
*/
static constexpr unsigned int INTERSECTED_ENTITY() { return IntersectionType::ENTITY; }
/**jsdoc
* @function Picks.INTERSECTED_LOCAL_ENTITY
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.INTERSECTED_LOCAL_ENTITY
+ * property instead.
* @returns {number}
*/
static constexpr unsigned int INTERSECTED_LOCAL_ENTITY() { return IntersectionType::LOCAL_ENTITY; }
/**jsdoc
* @function Picks.INTERSECTED_OVERLAY
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.INTERSECTED_LOCAL_ENTITY
+ * property instead.
* @returns {number}
*/
static constexpr unsigned int INTERSECTED_OVERLAY() { return INTERSECTED_LOCAL_ENTITY(); }
/**jsdoc
* @function Picks.INTERSECTED_AVATAR
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.INTERSECTED_AVATAR property
+ * instead.
* @returns {number}
*/
static constexpr unsigned int INTERSECTED_AVATAR() { return IntersectionType::AVATAR; }
/**jsdoc
* @function Picks.INTERSECTED_HUD
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Picks.INTERSECTED_HUD property
+ * instead.
* @returns {number}
*/
static constexpr unsigned int INTERSECTED_HUD() { return IntersectionType::HUD; }
diff --git a/interface/src/raypick/RayPickScriptingInterface.h b/interface/src/raypick/RayPickScriptingInterface.h
index 32b2b8fb68..a38e953824 100644
--- a/interface/src/raypick/RayPickScriptingInterface.h
+++ b/interface/src/raypick/RayPickScriptingInterface.h
@@ -163,98 +163,107 @@ public slots:
/**jsdoc
* @function RayPick.PICK_ENTITIES
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the Raypick.PICK_ENTITIES property instead.
* @returns {number}
*/
static unsigned int PICK_ENTITIES() { return PickScriptingInterface::PICK_ENTITIES(); }
/**jsdoc
* @function RayPick.PICK_OVERLAYS
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the RayPick.PICK_OVERLAYS property instead.
* @returns {number}
*/
static unsigned int PICK_OVERLAYS() { return PickScriptingInterface::PICK_OVERLAYS(); }
/**jsdoc
* @function RayPick.PICK_AVATARS
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the RayPick.PICK_AVATARS property instead.
* @returns {number}
*/
static unsigned int PICK_AVATARS() { return PickScriptingInterface::PICK_AVATARS(); }
/**jsdoc
* @function RayPick.PICK_HUD
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the RayPick.PICK_HUD property instead.
* @returns {number}
*/
static unsigned int PICK_HUD() { return PickScriptingInterface::PICK_HUD(); }
/**jsdoc
* @function RayPick.PICK_COARSE
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the RayPick.PICK_COARSE property instead.
* @returns {number}
*/
static unsigned int PICK_COARSE() { return PickScriptingInterface::PICK_COARSE(); }
/**jsdoc
* @function RayPick.PICK_INCLUDE_INVISIBLE
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the RayPick.PICK_INCLUDE_INVISIBLE
+ * property instead.
* @returns {number}
*/
static unsigned int PICK_INCLUDE_INVISIBLE() { return PickScriptingInterface::PICK_INCLUDE_INVISIBLE(); }
/**jsdoc
* @function RayPick.PICK_INCLUDE_NONCOLLIDABLE
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the RayPick.PICK_INCLUDE_NONCOLLIDABLE
+ * property instead.
* @returns {number}
*/
static unsigned int PICK_INCLUDE_NONCOLLIDABLE() { return PickScriptingInterface::PICK_INCLUDE_NONCOLLIDABLE(); }
/**jsdoc
* @function RayPick.PICK_ALL_INTERSECTIONS
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the RayPick.PICK_ALL_INTERSECTIONS
+ * property instead.
* @returns {number}
*/
static unsigned int PICK_ALL_INTERSECTIONS() { return PickScriptingInterface::PICK_ALL_INTERSECTIONS(); }
/**jsdoc
* @function RayPick.INTERSECTED_NONE
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the RayPick.INTERSECTED_NONE property
+ * instead.
* @returns {number}
*/
static unsigned int INTERSECTED_NONE() { return PickScriptingInterface::INTERSECTED_NONE(); }
/**jsdoc
* @function RayPick.INTERSECTED_ENTITY
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the RayPick.INTERSECTED_ENTITY property
+ * instead.
* @returns {number}
*/
static unsigned int INTERSECTED_ENTITY() { return PickScriptingInterface::INTERSECTED_ENTITY(); }
/**jsdoc
* @function RayPick.INTERSECTED_OVERLAY
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the RayPick.INTERSECTED_LOCAL_ENTITY
+ * property instead.
* @returns {number}
*/
static unsigned int INTERSECTED_LOCAL_ENTITY() { return PickScriptingInterface::INTERSECTED_LOCAL_ENTITY(); }
/**jsdoc
* @function RayPick.INTERSECTED_OVERLAY
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the RayPick.INTERSECTED_OVERLAY property
+ * instead.
* @returns {number}
*/
static unsigned int INTERSECTED_OVERLAY() { return PickScriptingInterface::INTERSECTED_LOCAL_ENTITY(); }
/**jsdoc
* @function RayPick.INTERSECTED_AVATAR
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the RayPick.INTERSECTED_AVATAR property
+ * instead.
* @returns {number}
*/
static unsigned int INTERSECTED_AVATAR() { return PickScriptingInterface::INTERSECTED_AVATAR(); }
/**jsdoc
* @function RayPick.INTERSECTED_HUD
- * @deprecated This function is deprecated and will be removed. Use the property of the same name instead.
+ * @deprecated This function is deprecated and will be removed. Use the RayPick.INTERSECTED_HUD property
+ * instead.
* @returns {number}
*/
static unsigned int INTERSECTED_HUD() { return PickScriptingInterface::INTERSECTED_HUD(); }
From 71f7132a6b1d57d4b179ccf3ce73be3429a550d0 Mon Sep 17 00:00:00 2001
From: David Rowe
Date: Wed, 8 May 2019 09:17:11 +1200
Subject: [PATCH 03/11] Scene JSDoc
---
.../src/SceneScriptingInterface.h | 86 ++++++++++++-------
1 file changed, 57 insertions(+), 29 deletions(-)
diff --git a/libraries/script-engine/src/SceneScriptingInterface.h b/libraries/script-engine/src/SceneScriptingInterface.h
index a78fa44641..fa67666676 100644
--- a/libraries/script-engine/src/SceneScriptingInterface.h
+++ b/libraries/script-engine/src/SceneScriptingInterface.h
@@ -21,10 +21,11 @@
namespace SceneScripting {
/**jsdoc
- * @typedef {object} Scene.Stage.Location
- * @property {number} longitude
- * @property {number} latitude
- * @property {number} altitude
+ * Stage location.
+ * @typedef {object} Stage.Location
+ * @property {number} longitude - Longitude.
+ * @property {number} latitude - Latitude.
+ * @property {number} altitude - Altitude.
*/
class Location : public QObject {
Q_OBJECT
@@ -49,9 +50,10 @@ namespace SceneScripting {
using LocationPointer = std::unique_ptr;
/**jsdoc
- * @typedef {object} Scene.Stage.Time
- * @property {number} hour
- * @property {number} day
+ * Stage time.
+ * @typedef {object} Stage.Time
+ * @property {number} hour - Hour.
+ * @property {number} day - Day.
*/
class Time : public QObject {
Q_OBJECT
@@ -73,11 +75,12 @@ namespace SceneScripting {
using TimePointer = std::unique_ptr
*
*
- *
Flag name
Value
Description
+ *
Flag Name
Value
Description
*
*
*
PICK_DOMAIN_ENTITIES
1
Include domain entities when intersecting.
diff --git a/libraries/shared/src/RegisteredMetaTypes.h b/libraries/shared/src/RegisteredMetaTypes.h
index ef2d775eec..25a1792fe2 100644
--- a/libraries/shared/src/RegisteredMetaTypes.h
+++ b/libraries/shared/src/RegisteredMetaTypes.h
@@ -296,7 +296,7 @@ void pickRayFromScriptValue(const QScriptValue& object, PickRay& pickRay);
* @typedef {object} StylusTip
* @property {number} side - The hand that the stylus is attached to: 0 for left hand, 1 for the
* right hand, -1 for invalid.
- * @property {Vec3} tipOffset - The position of the stylus tip relative to the body of the stylus.
+ * @property {Vec3} tipOffset - The position of the stylus tip relative to the body of the stylus.
* @property {Vec3} position - The position of the stylus tip.
* @property {Quat} orientation - The orientation of the stylus.
* @property {Vec3} velocity - The velocity of the stylus tip.
From 652ac17dacffc1c31180803f61d85721651a52b7 Mon Sep 17 00:00:00 2001
From: SamGondelman
Date: Mon, 13 May 2019 14:13:48 -0700
Subject: [PATCH 05/11] fix deadlock on startup
---
libraries/shared/src/DependencyManager.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libraries/shared/src/DependencyManager.h b/libraries/shared/src/DependencyManager.h
index 8eddb572cf..00faba0e89 100644
--- a/libraries/shared/src/DependencyManager.h
+++ b/libraries/shared/src/DependencyManager.h
@@ -89,7 +89,7 @@ private:
QHash> _instanceHash;
QHash _inheritanceHash;
- mutable QMutex _instanceHashMutex;
+ mutable QMutex _instanceHashMutex { QMutex::Recursive };
mutable QMutex _inheritanceHashMutex;
bool _exiting { false };
From ede8859cc777ef1ea5473c0c083777b754519b00 Mon Sep 17 00:00:00 2001
From: Simon Walton
Date: Mon, 13 May 2019 14:38:34 -0700
Subject: [PATCH 06/11] Call correct NodeList::reset() from Application
---
interface/src/Application.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp
index 678f737f25..bec12388ca 100644
--- a/interface/src/Application.cpp
+++ b/interface/src/Application.cpp
@@ -1298,8 +1298,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
connect(nodeList.data(), &NodeList::packetVersionMismatch, this, &Application::notifyPacketVersionMismatch);
// you might think we could just do this in NodeList but we only want this connection for Interface
- connect(&nodeList->getDomainHandler(), SIGNAL(limitOfSilentDomainCheckInsReached()),
- nodeList.data(), SLOT(reset()));
+ connect(&nodeList->getDomainHandler(), &DomainHandler::limitOfSilentDomainCheckInsReached,
+ [nodeList]() {nodeList->reset("Domain checkin limit"); });
auto dialogsManager = DependencyManager::get();
#if defined(Q_OS_ANDROID)
From 2e2d0add93ce18fbbbc5eba2c9dcc4751010bb5d Mon Sep 17 00:00:00 2001
From: Ryan Huffman
Date: Mon, 13 May 2019 13:04:46 -0700
Subject: [PATCH 07/11] BUGZ-89: Suppress getTransform spam
---
libraries/shared/src/SpatiallyNestable.cpp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libraries/shared/src/SpatiallyNestable.cpp b/libraries/shared/src/SpatiallyNestable.cpp
index 866698adeb..f49921f272 100644
--- a/libraries/shared/src/SpatiallyNestable.cpp
+++ b/libraries/shared/src/SpatiallyNestable.cpp
@@ -758,7 +758,11 @@ const Transform SpatiallyNestable::getTransform() const {
bool success;
Transform result = getTransform(success);
if (!success) {
- qCDebug(shared) << "getTransform failed for" << getID();
+ // There is a known issue related to child entities not being deleted
+ // when their parent is removed. This has the side-effect that the
+ // logs will be spammed with the following message. Until this is
+ // fixed, this log message will be suppressed.
+ //qCDebug(shared) << "getTransform failed for" << getID();
}
return result;
}
From 70ec84177aa808ae4a8d906f51a8ff9965ea19b0 Mon Sep 17 00:00:00 2001
From: David Rowe
Date: Tue, 14 May 2019 10:32:28 +1200
Subject: [PATCH 08/11] Doc review
---
interface/src/raypick/CollisionPick.cpp | 2 +-
interface/src/raypick/PickScriptingInterface.cpp | 2 +-
libraries/shared/src/PhysicsCollisionGroups.h | 2 +-
libraries/shared/src/RegisteredMetaTypes.h | 9 +++++----
4 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/interface/src/raypick/CollisionPick.cpp b/interface/src/raypick/CollisionPick.cpp
index b3888ae3a0..83ed61030e 100644
--- a/interface/src/raypick/CollisionPick.cpp
+++ b/interface/src/raypick/CollisionPick.cpp
@@ -61,7 +61,7 @@ void buildObjectIntersectionsMap(IntersectionType intersectionType, const std::v
* An intersection result for a collision pick.
*
* @typedef {object} CollisionPickResult
- * @property {boolean} intersects - truen if there is at least one intersection, false if there isn't.
+ * @property {boolean} intersects - true if there is at least one intersection, false if there isn't.
* @property {IntersectingObject[]} intersectingObjects - All objects which intersect with the collisionRegion.
* @property {CollisionRegion} collisionRegion - The collision region that was used. Valid even if there was no intersection.
*/
diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp
index dff68f3ded..82d00d803f 100644
--- a/interface/src/raypick/PickScriptingInterface.cpp
+++ b/interface/src/raypick/PickScriptingInterface.cpp
@@ -325,7 +325,7 @@ unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properti
* @property {number} threshold - The approximate minimum penetration depth for a test object to be considered in contact with
* the collision region. The depth is in world coordinates but scales with the parent if defined.
* @property {CollisionMask} [collisionGroup=8] - The type of objects the collision region collides as. Objects whose collision
- * masks overlap with the regions's collision group are considered to be colliding with the region.
+ * masks overlap with the region's collision group are considered to be colliding with the region.
*/
unsigned int PickScriptingInterface::createCollisionPick(const QVariant& properties) {
QVariantMap propMap = properties.toMap();
diff --git a/libraries/shared/src/PhysicsCollisionGroups.h b/libraries/shared/src/PhysicsCollisionGroups.h
index 7323133876..08fc5f5ac0 100644
--- a/libraries/shared/src/PhysicsCollisionGroups.h
+++ b/libraries/shared/src/PhysicsCollisionGroups.h
@@ -72,7 +72,7 @@ const int32_t BULLET_COLLISION_MASK_DETAILED_RAY = BULLET_COLLISION_GROUP_DETAIL
const int32_t BULLET_COLLISION_MASK_COLLISIONLESS = 0;
/**jsdoc
- *
A collision may be with the following types of items:
+ *
A collision may occur with the following types of items:
*
*
*
Value
Description
diff --git a/libraries/shared/src/RegisteredMetaTypes.h b/libraries/shared/src/RegisteredMetaTypes.h
index 25a1792fe2..dfd388230f 100644
--- a/libraries/shared/src/RegisteredMetaTypes.h
+++ b/libraries/shared/src/RegisteredMetaTypes.h
@@ -426,15 +426,16 @@ public:
/**jsdoc
* A volume for checking collisions in the physics simulation.
* @typedef {object} CollisionRegion
- * @property {Shape} shape - The collision region's shape and size. Dimensions are in world space, but scale with the parent
- * if defined.
- * @property {boolean} loaded - true if the shape has no model, or has a model and it is loaded.
+ * @property {Shape} shape - The collision region's shape and size. Dimensions are in world coordinates, but scale with the
+ * parent if defined.
+ * @property {boolean} loaded - true if the shape has no model, or has a model and it is loaded,
+ * false if otherwise.
* @property {Vec3} position - The position of the collision region, relative to the parent if defined.
* @property {Quat} orientation - The orientation of the collision region, relative to the parent if defined.
* @property {number} threshold - The approximate minimum penetration depth for a test object to be considered in contact with
* the collision region. The depth is in world coordinates but scales with the parent if defined.
* @property {CollisionMask} [collisionGroup=8] - The type of objects the collision region collides as. Objects whose collision
- * masks overlap with the regions's collision group are considered to be colliding with the region.
+ * masks overlap with the region's collision group are considered to be colliding with the region.
*/
/**jsdoc
From 305a215d21d000d023e24b6d03a9673b0c5ffb2d Mon Sep 17 00:00:00 2001
From: Simon Walton
Date: Mon, 13 May 2019 15:50:04 -0700
Subject: [PATCH 09/11] Pass a QObject context for the functor
---
interface/src/Application.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp
index bec12388ca..34efe1ba71 100644
--- a/interface/src/Application.cpp
+++ b/interface/src/Application.cpp
@@ -1299,7 +1299,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// you might think we could just do this in NodeList but we only want this connection for Interface
connect(&nodeList->getDomainHandler(), &DomainHandler::limitOfSilentDomainCheckInsReached,
- [nodeList]() {nodeList->reset("Domain checkin limit"); });
+ nodeList.data(), [nodeList]() {nodeList->reset("Domain checkin limit"); });
auto dialogsManager = DependencyManager::get();
#if defined(Q_OS_ANDROID)
From aeff5d93d88803b4d6f01b437359787fb8219483 Mon Sep 17 00:00:00 2001
From: Howard Stearns
Date: Mon, 13 May 2019 16:57:38 -0700
Subject: [PATCH 10/11] try a longer timeout before we removeSilentNodes
---
libraries/networking/src/LimitedNodeList.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libraries/networking/src/LimitedNodeList.h b/libraries/networking/src/LimitedNodeList.h
index 8593ad4b1b..4db4f3136a 100644
--- a/libraries/networking/src/LimitedNodeList.h
+++ b/libraries/networking/src/LimitedNodeList.h
@@ -49,7 +49,7 @@
const int INVALID_PORT = -1;
-const quint64 NODE_SILENCE_THRESHOLD_MSECS = 5 * 1000;
+const quint64 NODE_SILENCE_THRESHOLD_MSECS = 20 * 1000;
static const size_t DEFAULT_MAX_CONNECTION_RATE { std::numeric_limits::max() };
From 8b2d12e2f743b50e899ab69796e24de11834aba0 Mon Sep 17 00:00:00 2001
From: Seth Alves
Date: Thu, 9 May 2019 09:00:27 -0700
Subject: [PATCH 11/11] when an avatar entity is deleted, also delete its
descendants
---
interface/src/avatar/AvatarManager.cpp | 25 ++++++++++++++++++++++---
libraries/entities/src/EntityItem.cpp | 4 ++++
libraries/entities/src/EntityItem.h | 1 +
3 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/interface/src/avatar/AvatarManager.cpp b/interface/src/avatar/AvatarManager.cpp
index cea1a4a654..df620b9a08 100755
--- a/interface/src/avatar/AvatarManager.cpp
+++ b/interface/src/avatar/AvatarManager.cpp
@@ -532,13 +532,32 @@ void AvatarManager::handleProcessedPhysicsTransaction(PhysicsEngine::Transaction
}
void AvatarManager::removeDeadAvatarEntities(const SetOfEntities& deadEntities) {
+ auto treeRenderer = DependencyManager::get();
+ EntityTreePointer entityTree = treeRenderer ? treeRenderer->getTree() : nullptr;
for (auto entity : deadEntities) {
- QUuid sessionID = entity->getOwningAvatarID();
- AvatarSharedPointer avatar = getAvatarBySessionID(sessionID);
+ QUuid entityOwnerID = entity->getOwningAvatarID();
+ AvatarSharedPointer avatar = getAvatarBySessionID(entityOwnerID);
+ const bool REQUIRES_REMOVAL_FROM_TREE = false;
if (avatar) {
- const bool REQUIRES_REMOVAL_FROM_TREE = false;
avatar->clearAvatarEntity(entity->getID(), REQUIRES_REMOVAL_FROM_TREE);
}
+ if (entityTree && entity->isMyAvatarEntity()) {
+ entityTree->withWriteLock([&] {
+ // We only need to delete the direct children (rather than the descendants) because
+ // when the child is deleted, it will take care of its own children. If the child
+ // is also an avatar-entity, we'll end up back here. If it's not, the entity-server
+ // will take care of it in the usual way.
+ entity->forEachChild([&](SpatiallyNestablePointer child) {
+ EntityItemPointer childEntity = std::dynamic_pointer_cast(child);
+ if (childEntity) {
+ entityTree->deleteEntity(childEntity->getID(), true, true);
+ if (avatar) {
+ avatar->clearAvatarEntity(childEntity->getID(), REQUIRES_REMOVAL_FROM_TREE);
+ }
+ }
+ });
+ });
+ }
}
}
diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp
index d91c11e726..4232e9d1b9 100644
--- a/libraries/entities/src/EntityItem.cpp
+++ b/libraries/entities/src/EntityItem.cpp
@@ -3431,6 +3431,10 @@ bool EntityItem::isWearable() const {
(getParentID() == DependencyManager::get()->getSessionUUID() || getParentID() == AVATAR_SELF_ID);
}
+bool EntityItem::isMyAvatarEntity() const {
+ return _hostType == entity::HostType::AVATAR && Physics::getSessionUUID() == _owningAvatarID;
+};
+
void EntityItem::addGrab(GrabPointer grab) {
enableNoBootstrap();
SpatiallyNestable::addGrab(grab);
diff --git a/libraries/entities/src/EntityItem.h b/libraries/entities/src/EntityItem.h
index ea4b11e0b0..a8c3d31344 100644
--- a/libraries/entities/src/EntityItem.h
+++ b/libraries/entities/src/EntityItem.h
@@ -503,6 +503,7 @@ public:
virtual bool isWearable() const;
bool isDomainEntity() const { return _hostType == entity::HostType::DOMAIN; }
bool isAvatarEntity() const { return _hostType == entity::HostType::AVATAR; }
+ bool isMyAvatarEntity() const;
bool isLocalEntity() const { return _hostType == entity::HostType::LOCAL; }
entity::HostType getEntityHostType() const { return _hostType; }
virtual void setEntityHostType(entity::HostType hostType) { _hostType = hostType; }