Skip to content

InteractableObject

MathiasBaumgartinger edited this page Mar 18, 2020 · 2 revisions

InteractableObject

Inspired by https://github.com/GodotVR/godot_openvr_fps ...

This is a superclass for interactable rigidbodies, onready it will be included in the group of InteractableObject. This way the ObjectInteraction will scan for it. Furthermore, it defines three functions that have to be implemented in any InteractableObject:

  1. picked_up(my_controller: ARVRController): This happens when the pick-up-button is pressed on the current controller. The controller property will be set to my_controller and the bool defining if it is picked up will be set to true.
  2. interact(): This method will be called, when the interaction-button is pressed on the current controller. It can be the shoot trigger for a pewpew-gun for example.
  3. dropped(): This happens when the pick-up-button is pressed on the current controller. To make it possible to throw things. A technique that saves the current translation of the controller, waits for a physics frame, subtracts the new translation by the old one resulting in a direction is also included. This direction will then be usesd to apply an impulse on the rigidbody. The controller will be set to null, the picked up bool will be set to false
Clone this wiki locally