Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated code to find player resource nodes #70

Closed
Malcolmnixon opened this issue Feb 5, 2022 · 3 comments · Fixed by #88
Closed

Duplicated code to find player resource nodes #70

Malcolmnixon opened this issue Feb 5, 2022 · 3 comments · Fixed by #88
Labels
enhancement New feature or request
Milestone

Comments

@Malcolmnixon
Copy link
Collaborator

There are numerous almost-identical routines to find player resource nodes:

  • Find the ARVROrigin from a node under the player
  • Find the ARVRCamera from a node under the player
  • Find the PlayerBody from a node under the player

MovementProvider.gd has some of these functions, but they only work if the caller is a MovementProvider. Instead it would be better if these find routines were available to any node under the player - for example by making them static functions of a helper script.

@BastiaanOlij
Copy link
Member

It would indeed be nice to have a number of these functions in an autoload script, my main worry here is that this requires a setup action and I want as much as possible to remain automatic.

I wish GDScript had an include function :)

@Malcolmnixon
Copy link
Collaborator Author

I added a pull request showing an example of what I'm thinking of. It lets a node located anywhere under the ARVROrigin do:

    var origin := ARVRHelpers.get_arvr_origin(self)
    var camera := ARVRHelpers.get_arvr_camera(self)
    var left_controller := ARVRHelpers.get_left_controller(self)
    var right_controller := ARVRHelpers.get_right_controller(self)

@BastiaanOlij
Copy link
Member

Yeah 100% agree with what it does, just thinking of how we can have the helper node there or auto loaded so the user of the plugin doesn't need to be instructed to do so before starting to use the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants