remove proximity grab
This commit is contained in:
parent
fed7701da4
commit
b3474b16a0
|
@ -25,7 +25,6 @@ var left_pointer: Pointer
|
||||||
var right_pointer: Pointer
|
var right_pointer: Pointer
|
||||||
var press_distance = 0.03
|
var press_distance = 0.03
|
||||||
var grip_distance = 0.03
|
var grip_distance = 0.03
|
||||||
var close_distance = 0.1
|
|
||||||
|
|
||||||
var pressed_left = false
|
var pressed_left = false
|
||||||
var pressed_right = false
|
var pressed_right = false
|
||||||
|
@ -99,55 +98,34 @@ func _process_hand(hand: OpenXRHand):
|
||||||
var distance_trigger = index_tip.global_position.distance_to(thumb_tip.global_position)
|
var distance_trigger = index_tip.global_position.distance_to(thumb_tip.global_position)
|
||||||
var distance_grab = middle_tip.global_position.distance_to(thumb_tip.global_position)
|
var distance_grab = middle_tip.global_position.distance_to(thumb_tip.global_position)
|
||||||
|
|
||||||
var distance_target = _ray.get_collision_point().distance_to(_ray.global_position)
|
|
||||||
|
|
||||||
var trigger_close = distance_trigger <= press_distance
|
var trigger_close = distance_trigger <= press_distance
|
||||||
var grab_close = distance_grab <= grip_distance
|
var grab_close = distance_grab <= grip_distance
|
||||||
var distance_close = distance_target <= close_distance
|
|
||||||
|
|
||||||
if hand == hand_left:
|
if hand == hand_left:
|
||||||
|
if trigger_close&&!pressed_left:
|
||||||
|
initiator.on_press.emit(Initiator.EventType.TRIGGER)
|
||||||
|
pressed_left = true
|
||||||
|
elif !trigger_close&&pressed_left:
|
||||||
|
initiator.on_release.emit(Initiator.EventType.TRIGGER)
|
||||||
|
pressed_left = false
|
||||||
|
|
||||||
if !distance_close:
|
if grab_close&&!grabbed_left:
|
||||||
if trigger_close&&!pressed_left:
|
initiator.on_press.emit(Initiator.EventType.GRIP)
|
||||||
initiator.on_press.emit(Initiator.EventType.TRIGGER)
|
grabbed_left = true
|
||||||
pressed_left = true
|
elif !grab_close&&grabbed_left:
|
||||||
elif !trigger_close&&pressed_left:
|
initiator.on_release.emit(Initiator.EventType.GRIP)
|
||||||
initiator.on_release.emit(Initiator.EventType.TRIGGER)
|
grabbed_left = false
|
||||||
pressed_left = false
|
|
||||||
|
|
||||||
if grab_close&&!grabbed_left:
|
|
||||||
initiator.on_press.emit(Initiator.EventType.GRIP)
|
|
||||||
grabbed_left = true
|
|
||||||
elif !grab_close&&grabbed_left:
|
|
||||||
initiator.on_release.emit(Initiator.EventType.GRIP)
|
|
||||||
grabbed_left = false
|
|
||||||
else:
|
|
||||||
if trigger_close&&!grabbed_left:
|
|
||||||
initiator.on_press.emit(Initiator.EventType.GRIP)
|
|
||||||
grabbed_left = true
|
|
||||||
elif !trigger_close&&grabbed_left:
|
|
||||||
initiator.on_release.emit(Initiator.EventType.GRIP)
|
|
||||||
grabbed_left = false
|
|
||||||
else:
|
else:
|
||||||
if !distance_close:
|
if trigger_close&&!pressed_right:
|
||||||
if trigger_close&&!pressed_right:
|
initiator.on_press.emit(Initiator.EventType.TRIGGER)
|
||||||
initiator.on_press.emit(Initiator.EventType.TRIGGER)
|
pressed_right = true
|
||||||
pressed_right = true
|
elif !trigger_close&&pressed_right:
|
||||||
elif !trigger_close&&pressed_right:
|
initiator.on_release.emit(Initiator.EventType.TRIGGER)
|
||||||
initiator.on_release.emit(Initiator.EventType.TRIGGER)
|
pressed_right = false
|
||||||
pressed_right = false
|
|
||||||
|
|
||||||
if grab_close&&!grabbed_right:
|
if grab_close&&!grabbed_right:
|
||||||
initiator.on_press.emit(Initiator.EventType.GRIP)
|
initiator.on_press.emit(Initiator.EventType.GRIP)
|
||||||
grabbed_right = true
|
grabbed_right = true
|
||||||
elif !grab_close&&grabbed_right:
|
elif !grab_close&&grabbed_right:
|
||||||
initiator.on_release.emit(Initiator.EventType.GRIP)
|
initiator.on_release.emit(Initiator.EventType.GRIP)
|
||||||
grabbed_right = false
|
grabbed_right = false
|
||||||
|
|
||||||
else:
|
|
||||||
if trigger_close&&!grabbed_right:
|
|
||||||
initiator.on_press.emit(Initiator.EventType.GRIP)
|
|
||||||
grabbed_right = true
|
|
||||||
elif !trigger_close&&grabbed_right:
|
|
||||||
initiator.on_release.emit(Initiator.EventType.GRIP)
|
|
||||||
grabbed_right = false
|
|
Loading…
Reference in New Issue
Block a user