Elevator buttons need reworking #16

Open
opened 2026-02-07 14:32:32 +00:00 by jee7 · 0 comments
Collaborator

Currently the elevator buttons are using a custom-made SpringyButton component. This does not work, because it assumes two trigger colliders (one on the hand, one on the button) can detect each other. Unity does not support this. Only a non-trigger collider entering a trigger collider is what is supported.

But, there is a good solution available. We are using the Unity XR Interaction Toolkit in this project. This includes a XRPushButton class. The car button already uses this. The elevator buttons must use this as well (but with a very small push distance). Basically, an elevator button:

  • Should have the XRPushButton component set with a small push distance.
  • Should have another component named, for example, ElevatorButton. This one should have a OnPress() public function, which then calls the corresponding elevator logic.
  • The XRPushButton component allows defining a list of triggers (through the Editor GUI). There we should set the ElevatorButton.OnPress() callback.

All of the logic of the current SpringyButton as well as detecting collisions between two triggers (that we need for VR hands to interact with buttons and stuff) is all implemented already in the XRPushButton class. Let's use it! :)

Currently the elevator buttons are using a custom-made SpringyButton component. This does not work, because it assumes two trigger colliders (one on the hand, one on the button) can detect each other. Unity does not support this. Only a non-trigger collider entering a trigger collider is what is supported. But, there is a good solution available. We are using the Unity XR Interaction Toolkit in this project. This includes a XRPushButton class. The car button already uses this. The elevator buttons must use this as well (but with a very small push distance). Basically, an elevator button: * Should have the XRPushButton component set with a small push distance. * Should have another component named, for example, ElevatorButton. This one should have a OnPress() public function, which then calls the corresponding elevator logic. * The XRPushButton component allows defining a list of triggers (through the Editor GUI). There we should set the ElevatorButton.OnPress() callback. All of the logic of the current SpringyButton as well as detecting collisions between two triggers (that we need for VR hands to interact with buttons and stuff) is all implemented already in the XRPushButton class. Let's use it! :)
jee7 added the Kind/Bug
Priority
Medium
labels 2026-02-07 14:32:32 +00:00
rannosam was assigned by jee7 2026-02-07 14:32:32 +00:00
Sign in to join this conversation.