mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 22:13:12 +02:00
Fixed crash in lasterpointer
This commit is contained in:
parent
acded5488e
commit
57de55c5ce
1 changed files with 13 additions and 10 deletions
|
@ -233,16 +233,19 @@ PointerEvent LaserPointer::buildPointerEvent(const PickedObject& target, const P
|
||||||
|
|
||||||
// If we just started triggering and we haven't moved too much, don't update intersection and pos2D
|
// If we just started triggering and we haven't moved too much, don't update intersection and pos2D
|
||||||
TriggerState& state = hover ? _latestState : _states[button];
|
TriggerState& state = hover ? _latestState : _states[button];
|
||||||
float sensorToWorldScale = DependencyManager::get<AvatarManager>()->getMyAvatar()->getSensorToWorldScale();
|
auto avatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
float deadspotSquared = TOUCH_PRESS_TO_MOVE_DEADSPOT_SQUARED * sensorToWorldScale * sensorToWorldScale;
|
if (avatar) {
|
||||||
bool withinDeadspot = usecTimestampNow() - state.triggerStartTime < POINTER_MOVE_DELAY && glm::distance2(pos2D, state.triggerPos2D) < deadspotSquared;
|
float sensorToWorldScale = avatar->getSensorToWorldScale();
|
||||||
if ((state.triggering || state.wasTriggering) && !state.deadspotExpired && withinDeadspot) {
|
float deadspotSquared = TOUCH_PRESS_TO_MOVE_DEADSPOT_SQUARED * sensorToWorldScale * sensorToWorldScale;
|
||||||
pos2D = state.triggerPos2D;
|
bool withinDeadspot = usecTimestampNow() - state.triggerStartTime < POINTER_MOVE_DELAY && glm::distance2(pos2D, state.triggerPos2D) < deadspotSquared;
|
||||||
intersection = state.intersection;
|
if ((state.triggering || state.wasTriggering) && !state.deadspotExpired && withinDeadspot) {
|
||||||
surfaceNormal = state.surfaceNormal;
|
pos2D = state.triggerPos2D;
|
||||||
}
|
intersection = state.intersection;
|
||||||
if (!withinDeadspot) {
|
surfaceNormal = state.surfaceNormal;
|
||||||
state.deadspotExpired = true;
|
}
|
||||||
|
if (!withinDeadspot) {
|
||||||
|
state.deadspotExpired = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PointerEvent(pos2D, intersection, surfaceNormal, direction);
|
return PointerEvent(pos2D, intersection, surfaceNormal, direction);
|
||||||
|
|
Loading…
Reference in a new issue