Add JS docs for CollisionPick API

This commit is contained in:
sabrina-shanman 2018-07-25 16:49:41 -07:00
parent 8f993e4740
commit de6d30e160
2 changed files with 38 additions and 2 deletions

View file

@ -137,6 +137,23 @@ unsigned int PickScriptingInterface::createStylusPick(const QVariant& properties
return DependencyManager::get<PickManager>()->addPick(PickQuery::Stylus, std::make_shared<StylusPick>(side, filter, maxDistance, enabled));
}
/**jsdoc
* A Shape defines a physical volume.
*
* @typedef {object} Shape
* @property {ShapeType} shapeType The type of shape to use.
* @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.
* @property {Vec3} dimensions - The size to scale the shape to.
*/
/**jsdoc
* A set of properties that can be passed to {@link Picks.createPick} to create a new Collision Pick.
* @typedef {object} Picks.CollisionPickProperties
* @property {Shape} shape - The information about the collision region's size and shape.
* @property {Vec3} position - The position of the collision region.
* @property {Quat} orientation - The orientation of the collision region.
*/
unsigned int PickScriptingInterface::createCollisionPick(const QVariant& properties) {
QVariantMap propMap = properties.toMap();

View file

@ -73,7 +73,7 @@ public:
* 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.
* @function Picks.createPick
* @param {PickType} type A PickType that specifies the method of picking to use
* @param {Picks.RayPickProperties|Picks.StylusPickProperties} properties A PickProperties object, containing all the properties for initializing this Pick
* @param {Picks.RayPickProperties|Picks.StylusPickProperties|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.
*/
Q_INVOKABLE unsigned int createPick(const PickQuery::PickType type, const QVariant& properties);
@ -127,11 +127,30 @@ public:
* @property {StylusTip} stylusTip The StylusTip 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 (entityIntersections.length + avatarIntersections.length > 0)
* @property {EntityItersection[]} entityIntersections The collision information of entities which intersect with the CollisionRegion. There may be multiple intersections with the same entity which represent distinct collision points.
* @property {EntityItersection[]} avatarIntersections The collision information of avatars which intersect with the CollisionRegion. There may be multiple intersections with the same entity which represent distinct collision points.
* @property {CollisionRegion} collisionRegion The CollisionRegion that was used. Valid even if there was no intersection.
*/
/**jsdoc
* A pair of intersection points between a CollisionPick and an entity/avatar.
*
* @typedef {object} EntityIntersection
* @property {QUuid} id The ID of the object.
* @property {Vec3} pickCollisionPoint A point within the volume of the CollisionPick which corresponds to a point on the surface of the collided entity, in world space.
* @property {Vec3} entityCollisionPoint A point within the volume of the collided entity which corresponds to a point on the surface of the CollisionPick, in world space.
*/
/**jsdoc
* Get the most recent pick result from this Pick. This will be updated as long as the Pick is enabled.
* @function Picks.getPrevPickResult
* @param {number} uid The ID of the Pick, as returned by {@link Picks.createPick}.
* @returns {RayPickResult|StylusPickResult} The most recent intersection result. This will be different for different PickTypes.
* @returns {RayPickResult|StylusPickResult|CollisionPickResult} The most recent intersection result. This will be different for different PickTypes.
*/
Q_INVOKABLE QVariantMap getPrevPickResult(unsigned int uid);