History

wiggly lasers

HifiExperiments committed 2 years ago

Commit 30646471 parent bc45c1715 files · +205 −144Browse files

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

Unified · Split

interface/src/raypick/PickScriptingInterface.cpp+9−1
@@ -121,6 +121,7 @@ PickFilter getPickFilter(unsigned int filter) { · 120 unmodified lines
121 * @property {Vec3} [dirOffset] - Synonym for <code>direction</code>.121 * @property {Vec3} [dirOffset] - Synonym for <code>direction</code>.
122 * @property {Quat} [orientation] - Alternative property for specifying <code>direction</code>. The value is applied to the 122 * @property {Quat} [orientation] - Alternative property for specifying <code>direction</code>. The value is applied to the
123 * default <code>direction</code> value.123 * default <code>direction</code> value.
124 * @property {number} [delay=0.0] - The delay, in seconds, to apply to the ray direction.
124 * @property {PickType} pickType - The type of pick when getting these properties from {@link Picks.getPickProperties} or 125 * @property {PickType} pickType - The type of pick when getting these properties from {@link Picks.getPickProperties} or
125 * {@link Picks.getPickScriptParameters}. A ray pick's type is {@link PickType.Ray}.126 * {@link Picks.getPickScriptParameters}. A ray pick's type is {@link PickType.Ray}.
126 * @property {Vec3} baseScale - Returned from {@link Picks.getPickProperties} when the pick has a parent with varying scale 127 * @property {Vec3} baseScale - Returned from {@link Picks.getPickProperties} when the pick has a parent with varying scale
@@ -173,7 +174,14 @@ std::shared_ptr<PickQuery> PickScriptingInterface::buildRayPick(const QVariantMa · 46 unmodified lines
173 direction = vec3FromVariant(propMap["dirOffset"]);174 direction = vec3FromVariant(propMap["dirOffset"]);
174 }175 }
175 176
176 auto rayPick = std::make_shared<RayPick>(position, direction, filter, maxDistance, enabled);177 float delayHalf = 0.0f;
178 if (propMap["delay"].isValid()) {
179 // We want to be within 0.1% of the target in <delay> seconds
180 // https://twitter.com/FreyaHolmer/status/1757836988495847568
181 delayHalf = -std::max(propMap["delay"].toFloat(), 0.0f) / log2(0.001);
182 }
183
184 auto rayPick = std::make_shared<RayPick>(position, direction, filter, maxDistance, delayHalf, enabled);
177 setParentTransform(rayPick, propMap);185 setParentTransform(rayPick, propMap);
178 186
179 return rayPick;187 return rayPick;