NeoSpark314 / godot_oculus_quest_toolkit

An easy to use VR toolkit for Oculus Quest development using the Godot game engine
MIT License
368 stars 39 forks source link

Add articulating tools #24

Closed ellenhp closed 4 years ago

ellenhp commented 4 years ago

Hey! Here's a PR containing code for allowing users to use tracked controllers for interacting with articulating tools. The demo scene contains a pistol that users can pick up, pass between their hands, drop and throw. The slide on the pistol can also be pulled back by the player's non-dominant hand. There aren't any signals emitted when the slide is racked which you'd need for an actual game, and there aren't any animations making it slam forward, but it's a good starting point for anyone who needs this kind of interaction in a quest game.

There isn't any code allowing developers to create tools that articulate by rotation (e.g. for a fishing pole), but the code is modular so it shouldn't be too difficult to add something like a fishing rod if someone needs it. All they would need to do is extend OQClass_ToolGrabController.gd, the class responsible for posing the articulating parts of a tool. Developers can use OQClass_ToolGrabLinearController.gd as a working example for linear motion and base their solutions on that.

While this is generic enough for any sliding tool, I doubt anyone can make a game with it as-is. This is my first contribution to a godot codebase so please make sure I checked in all of the right files and none of the wrong ones (.import ??). I'm also a beginner in godot world so it might be good to look over the way I structured the system for any errors. It seemed reasonable to me, though.

NeoSpark314 commented 4 years ago

Looks really good to me. Adding .import files is usually a good idea as they contain all the settings on how to import an asset and the rest of the scene might depend on how they are imported.

I will probably add later a button to the UIDemoScene so your gun demo scene can be reached from the main menu area.

At some point we should also document it on the wiki as I expect many people are interested in this functionality.

Thanks a lot!