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

Feature Request - Add Simple "Grapple Hook Movement" Functionality #122

Closed
teddybear082 opened this issue Apr 27, 2022 · 11 comments · Fixed by #126
Closed

Feature Request - Add Simple "Grapple Hook Movement" Functionality #122

teddybear082 opened this issue Apr 27, 2022 · 11 comments · Fixed by #126
Labels
enhancement New feature or request
Milestone

Comments

@teddybear082
Copy link
Contributor

Understanding this isn't hugely different from the teleport functionality XR-Tools already has, a simple "batman bat-hook" style of grappling hook where the player is pulled to the "hook" location would be neat to have.

I have a simple version of a movement provider scene and script implementing this here, which I'm sure could be improved upon: https://drive.google.com/drive/folders/1osoVU7tWHyNJwMDtK8jpxOt9aVN4Rsgb?usp=sharing

The user can choose hook speed, which controls how fast the player gets to the hook point (and if low enough, whether the player fully makes it there at all) and hook length to control how far the player can "shoot." Right now there is no mesh like the shooting of a physical hook or line implemented as I haven't figured that out yet, but there is a target, modeled off of the one that is used for the existing Pointer Function (the target is a different shape, a cube instead of a sphere, in case a player had both Pointer-with-target and Hook functions on, to distinguish them).

Note that this is also different from a "spider man web" style grappling system that has a lot more physics and bounce to it, which I don't know how to do.

@teddybear082
Copy link
Contributor Author

Edit- the files above now have a "working" line mesh.

@Malcolmnixon
Copy link
Collaborator

Malcolmnixon commented May 3, 2022

I've got it working despite a mostly busted controller. There are some changes I'm looking to make:

  • All movement providers already have an 'enabled' property for situational disabling, so I think 'canGrapple' can be removed
  • All visibility updates (target and line) should be updated in _process() to prevent flicker
  • Grapple target should be hidden while grappling (as the line is visible)
  • Grapple collision should be settable in the Function_Grapple properties

The current "mode" appears to be to fire the user towards the hook_point, but then normal physics takes over and the grapple line is just for show. This initially works well, but then the player just falls to the ground.

I tried a second "mode" which is to linearly move the player towards the hook_point with physics turned off. This gets the player to the target, but doesn't feel very good.

I'm looking into a third "mode" where again the player is thrown towards the target, but essentially the rope is a ratchet which doesn't let the player move further away from the target. Eventually the player would be swinging by the rope until they let go. This would take some interesting vector math.

@Malcolmnixon
Copy link
Collaborator

@teddybear082 I've put an example with swing mechanics in https://github.com/Malcolmnixon/godot-xr-tools-demo. There's still some more cleanup to do, but could you check it out and see what you think.

@teddybear082
Copy link
Contributor Author

That's awesome will try it out soon! Appreciate your quick work on this!

@teddybear082
Copy link
Contributor Author

@Malcolmnixon Tried it. You're a genius. Your implementation is very slick, love it. Hope this can find its way into the official XR-tools in the next release!!

@Malcolmnixon
Copy link
Collaborator

I think I want to add one more thing - a "winch" velocity which tries to pull the user towards the target at a slow speed - just need to play with the physics of it a little more.

@Malcolmnixon
Copy link
Collaborator

@teddybear082 I just did another update and I think it feels a little more natural. There's an initial impulse and a slow winch if you hold the grapple down. I also added simulated air friction to dampen the wild swings. Could you let me know if you're comfortable with the feel of it as well, and if so I'll turn this into a pull request for godot-xr-tools.

@teddybear082
Copy link
Contributor Author

I like it! I personally like how you did it with your last iteration by default but grappling is very subjective and so what is better about this one is all of customization you built in so I was also able to get that feel by adjusting the winch and impulse values with this model and yet this model will also appeal to people who want a different feel. Really great!

@Malcolmnixon
Copy link
Collaborator

I think the physics of the actual swinging is good; but when I added grappling to my "DemoAll" example with all the movement providers available, I found a few more things need to be fixed:

  • The hand-off between movement providers isn't clean - For example gliding to grappling like batman doesn't report the end of the gliding so the gliding sound still plays
  • The player should still be blown around by the wind while grappling

I'll fix these and then get a pull request going.

@teddybear082
Copy link
Contributor Author

Cool! I forget, do I close the issue or do you? I think we can close this one now.

@Malcolmnixon
Copy link
Collaborator

The pull request is associated with this feature request, so once the pull request is merged into the main branch a final test is performed and the ticket is closed. Until then we keep the ticket open in case the review finds more work or issues that need fixing.

@BastiaanOlij BastiaanOlij added the enhancement New feature or request label May 9, 2022
@BastiaanOlij BastiaanOlij added this to the 2.4.0 milestone May 9, 2022
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
3 participants