History

Add scaleWithParent option to collision pick creation

sabrina-shanman committed 8 years ago

Commit 44efe641 parent e1761433 files · +21 −6Browse files

Showing the changes to interface/src/raypick/PickScriptingInterface.cpp (1 of 3 files). Show all

Unified · Split

interface/src/raypick/PickScriptingInterface.cpp+7−1
@@ -254,6 +254,7 @@ unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properti · 253 unmodified lines
254254 * @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, or an overlay.
255255 * @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)
256256 * @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.
257+* @property {boolean} [scaleWithParent=true] If true, the collision pick's dimensions and threshold will adjust according to the scale of the parent.
257258 */
258259 unsigned int PickScriptingInterface::createCollisionPick(const QVariant& properties) {
259260 QVariantMap propMap = properties.toMap();
@@ -273,8 +274,13 @@ unsigned int PickScriptingInterface::createCollisionPick(const QVariant& propert · 13 unmodified lines
273274 maxDistance = propMap["maxDistance"].toFloat();
274275 }
275276
277+ bool scaleWithParent = true;
278+ if (propMap["scaleWithParent"].isValid()) {
279+ scaleWithParent = propMap["scaleWithParent"].toBool();
280+ }
281+
276282 CollisionRegion collisionRegion(propMap);
277− auto collisionPick = std::make_shared<CollisionPick>(filter, maxDistance, enabled, collisionRegion, qApp->getPhysicsEngine());
283+ auto collisionPick = std::make_shared<CollisionPick>(filter, maxDistance, enabled, scaleWithParent, collisionRegion, qApp->getPhysicsEngine());
278284 setParentTransform(collisionPick, propMap);
279285
280286 return DependencyManager::get<PickManager>()->addPick(PickQuery::Collision, collisionPick);