remove proximity grab

This commit is contained in:
Nitwel 2024-04-30 09:01:10 +02:00
parent fed7701da4
commit b3474b16a0

View File

@ -25,7 +25,6 @@ var left_pointer: Pointer
var right_pointer: Pointer
var press_distance = 0.03
var grip_distance = 0.03
var close_distance = 0.1
var pressed_left = false
var pressed_right = false
@ -99,15 +98,10 @@ func _process_hand(hand: OpenXRHand):
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_target = _ray.get_collision_point().distance_to(_ray.global_position)
var trigger_close = distance_trigger <= press_distance
var grab_close = distance_grab <= grip_distance
var distance_close = distance_target <= close_distance
if hand == hand_left:
if !distance_close:
if trigger_close&&!pressed_left:
initiator.on_press.emit(Initiator.EventType.TRIGGER)
pressed_left = true
@ -122,14 +116,6 @@ func _process_hand(hand: OpenXRHand):
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:
if !distance_close:
if trigger_close&&!pressed_right:
initiator.on_press.emit(Initiator.EventType.TRIGGER)
pressed_right = true
@ -143,11 +129,3 @@ func _process_hand(hand: OpenXRHand):
elif !grab_close&&grabbed_right:
initiator.on_release.emit(Initiator.EventType.GRIP)
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