Showing the changes to interface/src/raypick/PickScriptingInterface.cpp (1 of 131 files). Show all
Unified · Split
| @@ -31,6 +31,9 @@ · 30 unmodified lines | ||
| 31 | 31 | |
| 32 | 32 | #include <ScriptEngine.h> |
| 33 | 33 | |
| 34 | +static const float WEB_TOUCH_Y_OFFSET = 0.105f; // how far forward (or back with a negative number) to slide stylus in hand | |
| 35 | +static const glm::vec3 TIP_OFFSET = glm::vec3(0.0f, StylusPick::WEB_STYLUS_LENGTH - WEB_TOUCH_Y_OFFSET, 0.0f); | |
| 36 | + | |
| 34 | 37 | unsigned int PickScriptingInterface::createPick(const PickQuery::PickType type, const QVariant& properties) { |
| 35 | 38 | switch (type) { |
| 36 | 39 | case PickQuery::PickType::Ray: |
| @@ -137,7 +140,12 @@ unsigned int PickScriptingInterface::createStylusPick(const QVariant& properties · 100 unmodified lines | ||
| 137 | 140 | maxDistance = propMap["maxDistance"].toFloat(); |
| 138 | 141 | } |
| 139 | 142 | |
| 140 | − return DependencyManager::get<PickManager>()->addPick(PickQuery::Stylus, std::make_shared<StylusPick>(side, filter, maxDistance, enabled)); | |
| 143 | + glm::vec3 tipOffset = TIP_OFFSET; | |
| 144 | + if (propMap["tipOffset"].isValid()) { | |
| 145 | + tipOffset = vec3FromVariant(propMap["tipOffset"]); | |
| 146 | + } | |
| 147 | + | |
| 148 | + return DependencyManager::get<PickManager>()->addPick(PickQuery::Stylus, std::make_shared<StylusPick>(side, filter, maxDistance, enabled, tipOffset)); | |
| 141 | 149 | } |
| 142 | 150 | |
| 143 | 151 | // NOTE: Laser pointer still uses scaleWithAvatar. Until scaleWithAvatar is also deprecated for pointers, scaleWithAvatar should not be removed from the pick API. |
| @@ -416,4 +424,4 @@ void PickScriptingInterface::setParentTransform(std::shared_ptr<PickQuery> pick, · 272 unmodified lines | ||
| 416 | 424 | pick->parentTransform = std::make_shared<PickTransformNode>(pickID); |
| 417 | 425 | } |
| 418 | 426 | } |
| 419 | −} | |
| 427 | +} | |