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

Automatic Left handed bindings + Switch weapon hands #92

Merged
merged 21 commits into from
Jan 22, 2025

Conversation

97saundersj
Copy link
Contributor

@97saundersj 97saundersj commented Dec 12, 2024

Automatic Left handed bindings + Switch weapon hands

Swapping.Hands.Demo.mp4

Update Notes:

  • Updated Left-Handed Mode: When LeftHanded is enabled in the config the left handed action set bindings will be used. This means that left handed bindings will be used automatically but bindings for swapping the sticks can still be found on the game's SteamVR controller bindings page.
  • Swapping Weapons Between Hands: Added the ability to swap weapons between hands by bringing your hands close together and using the SwapWeaponHand binding (This can be configured in SteamVR's bindings). By default, this is bound to the grip button on your non-dominant hand and changes hands depending on whether the weapon is currently in your left or right hand. Whilst holding a weapon in your left hand the left handed SteamVR Action Set Bindings will be used. The distance required between hands can be configured in the config.txt file or the feature can be disabled.

To use these changes, you will have to either use the default bindings or manually add bindings to the new left handed SteamVR Action Set.

SteamVR bindings showing the new left handed action set - you can see that the bindings have swapped hands
image

Changes
I have also edited the following config settings:

  • Added SwapHandDistance: [Float]
  • Added OffhandHandFlashlight [Bool]
  • Enabled RightHandFlashlight [Float] by giving it a default value

I have enabled these by default since the swapping weapon hands is easy to ignore if you don't want to use it and the flashlight changes will still work the same way as before by default if you don't swap hands.

This is working great for me with default bindings on a quest 3, but I need feedback about other custom bindings and other devices.

Files are available here for testing: HaloCEVR.zip

Note: It might also be worth removing the exsisting default Left Handed Bindings since they are covered with the new action set, apart from swapping the sticks.

Any feedback is appreciated :)

Future Work (For a seperate PR)

  • Swap weapons from a holster straight into your offhand
  • Pick up weapons straight into your offhand
  • Hold weapons only by their grip

@97saundersj 97saundersj changed the title Added ability to swap weapon hands Switch weapon hands Dec 13, 2024
@slipperfish
Copy link
Contributor

This is cool, sometimes I did want to switch hands when playing campaign. After trying this I don't want to switch hands anymore, but I do want to dual wield.

For me these updates are fun things I get free, but I want to say helpful things so your time is well spent. This makes me curious what your ideas are looking forward, in the case of manual reloading or grenade throwing became realities and what it means for this feature. Especially with a Swap weapons from a holster straight into your offhand feature making both shoulders weapon holsters. I also don't know if asking if dual wielding can happen is a dumb question or not, or where the power of d3d9.dll ends.

Another type of hand swap I thought about is holding the foregrip in off hand while releasing the trigger grip. If not for naturalness of interaction, but maybe for fast dominant hand grenades then resuming your grip, as if that will be a thing. Don't think about it too much.

Anyway on to what I noticed:

You should make it where the empty hand can't grab the weapon if the full hand is squeezing the grip button. Just prevents accidental hand swaps, especially the pistol.

The flashlight activation didn't seem to be mirrored and I can accidentally activate it when using a weapon in the offhand.

…flashlight and prevented weapon swapping whilst holding the grip button
@97saundersj
Copy link
Contributor Author

Thank you @slipperfish for the feedback, it's always super helpful!

Basically my goal is that every control and interaction being as close to reality as possible, e.g. being able to use your weapon with whichever hand you want, dual wielding, manual reloading, physically throwing grenades etc.
For me my goal would be to have the vr interactions work similar to boneworks where you have flexability to use weapons and play however you want to.
With dual wielding, that may be possible or at least a very very very rough hacky version of it. I've been playing around with trying to get it roughly usable by esentially swapping your weapon very quickly between both hands, which works but with lots of flickering, but I'm hoping I can get feedback from the community about that.
Thats a good idea with being able to just hold a weapon by your offgrip, it's something I've been thinking about but would probably have to be in a seperate PR to prevent overloading this one.

Those issues you raised should now be fixed :)

@slipperfish
Copy link
Contributor

slipperfish commented Dec 14, 2024

You should make it where the empty hand can't grab the weapon if the full hand is squeezing the grip button.

Woops I realized this was bad advice, or incomplete advice. It's messing with my smooth hand transitions where I don't "toss" the gun, but when I'm simulating holding the handle with both hands at one point during the swap. I think I got it now.

This part is currently working in your build:

Full hand holding grip button --> Empty hand presses and holds grip button (nothing happens) --> Empty hand releases grip button (nothing happens).

This is the new part:

Full hand holding grip button --> Empty hand presses and holds grip button (nothing happens) --> Full hand releases grip button (weapon changes hands).

Basically the hand that lets go first forfeits the gun.

@97saundersj 97saundersj changed the title Switch weapon hands Automatic Left handed bindings + Switch weapon hands Dec 30, 2024
@97saundersj 97saundersj marked this pull request as ready for review December 30, 2024 22:42
@97saundersj
Copy link
Contributor Author

@slipperfish Thanks for the feedback. Sorry it took me a while to get the changes ready again for testing. I wanted to get the changes in a state that I was happy with before asking you to review again, so I have finally marked the changes as ready for review.
I made the changes you suggested, so let me know how that feels!
I changed the bindings to use action sets, so you will have to use the default bindings or customize your existing ones.

@slipperfish
Copy link
Contributor

slipperfish commented Jan 3, 2025

Thanks for adding that over the holidays. Grabbing works great and I don't have to think about my grip style anymore

I did notice when grabbing or releasing the two handed grip, the weapon would flash in slightly off locations briefly before correcting. Did this ghosting fix in #105 introduce something? (EDIT: This seems to be a pre-existing bug, disregard.)

I could only get the flashlight to work when holding a weapon in my right hand. When holding a weapon in my left hand it wasn't togglable. I always use default bindings and generated a fresh config to make sure that wasn't the problem.

Aside from vibration feedback on grip, I did think of one more improvement for another day. To give visual feedback when your empty hand grips the handle, weapons could have a palm-over-fist grip pose like the pistol's two handed grip.

Thanks again

@LivingFray LivingFray merged commit a5a3101 into LivingFray:master Jan 22, 2025
@slipperfish
Copy link
Contributor

Just a heads up I installed 1.3.0 with a fresh config.txt and hand switching isn't working

@slipperfish
Copy link
Contributor

@LivingFray got this build error on the latest build

InputHandler.cpp(128,8): warning C4101: 'bSwitchWeaponsChanged': unreferenced local variable

@LivingFray
Copy link
Owner

Just a heads up I installed 1.3.0 with a fresh config.txt and hand switching isn't working

Strange, the hand switching worked for me and I haven't touched any settings related to it.

@LivingFray got this build error on the latest build

InputHandler.cpp(128,8): warning C4101: 'bSwitchWeaponsChanged': unreferenced local variable

I've removed the offending line, but its only a warning so it shouldn't matter anyway unless you have your compiler set to error on warnings

@slipperfish
Copy link
Contributor

I do not know why but I wasn't able to reproduce it. It's working now.

@HoriZon-HZN
Copy link

HoriZon-HZN commented Jan 23, 2025

To get the flashlight to work set RightHandFlashlight to 0.2 as well.

@slipperfish
Copy link
Contributor

Thanks horizon forgot to say that was working again because I'm going to start assuming my own user error around here. I think the zip file was outdated when I tested it

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

Successfully merging this pull request may close these issues.

4 participants