Godot Version
4.6.2
Question
Hi! I wanted to create a lil VR game using the XR Tools Addon in which interacting with a door knob loads a new level. I understand how PickableObjects work, but I can’t seem to find a simple solution for interactable object. Like I want to grab it like a PickableObject and then execute code to load a new scene.
Thank you!
The way I’ve done it is make a class called interactable or whatever.
Put a function in the base class func do_something and give it a pass or make the class abstract.
Have your object extend that class. Then make your own func do_something with the code to do what you want.
Then you just send a raycast or whatever and if it collides, use if collider is interactable: collider.do_something()
This guy does varying versions and has some good ideas:
thank you. I’m not sure how this would translate into XR Tools’s case of using VR controllers
OK, according to this page:
There is a signal emitted for when the object is grabbed, and a signal when the action button is pressed. You can add a script to the scene or whatever to receive the signal. Then just connect it with the editor and call the code for the next scene from that script. I haven’t used xr tools, but that would probably be the easiest way.