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

Add weighted logic to collision hands #695

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

BastiaanOlij
Copy link
Member

This is an implementation of weighted hands based on the current logic for holding objects in XR Tools.
It's far from perfect but it does a decent job within the current constraints of XR tools.

The main missing bit that would be an improvement is missing angular momentum when an object is held in a single hand (as dual wielding already compensates to an extent). But in order to do so we really need to tie properly into the physics engine and that requires a completely different type of logic for holding objects (I have been doing experimentation for this and may implement that approach for XR tools 2).

The other shortcoming is that when the user teleports, the movement breaks the maximum distance and we let go of the object. This I plan to resolve in a follow up PR as this requires proper signals being hooked up to our teleport system and I'm already planning work on this.

Contributed by Khronos Group through the Godot Integration Project

@BastiaanOlij BastiaanOlij added the enhancement New feature or request label Nov 21, 2024
@BastiaanOlij BastiaanOlij added this to the 4.4.0 milestone Nov 21, 2024
@BastiaanOlij BastiaanOlij self-assigned this Nov 21, 2024
Copy link
Contributor

@DigitalN8m4r3 DigitalN8m4r3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setting max pickup force on the collision hands to 250 gives better weight feel, however it somewhat feels disconnected.
for a sniper rifle, an empty one without scope would weight around 5.4kg/12lb.
snap rotation is not working properly with weight, the object lags behind and makes the hand that got the object picked up, lag behind in a twitching way.
not sure if its related but i cant properly grab the sniper handle, it disconnects as in not being able to fully grab it.
will have to play more with this pr but it is a good start.

@BastiaanOlij
Copy link
Member Author

not sure if its related but i cant properly grab the sniper handle, it disconnects as in not being able to fully grab it.
will have to play more with this pr but it is a good start.

If the object you pick up is too heavy that it lags behind too much, we'll eventually let it go. One thing I do need to fix here is that player movement is added into this as well.

@BastiaanOlij
Copy link
Member Author

Player movement is now directly applied to collision hands (and poke body while I was in there) including when you use teleporting.

The only scenario where we're not automatically reacting is if the player is moved outside of the player body methods (a few movement providers do this) but I need to react differently depending on how the player is moved.

@DigitalN8m4r3
Copy link
Contributor

Player movement is now directly applied to collision hands (and poke body while I was in there) including when you use teleporting.

The only scenario where we're not automatically reacting is if the player is moved outside of the player body methods (a few movement providers do this) but I need to react differently depending on how the player is moved.

right now even with your settings its not acceptable, upon performing turn movement it twitches and it seems that your recent changes made the still movement of the hands when holding, twitch just a lil as well and i think this wasnt the case before.
Too bad this really needs another pair of eyes, one that can actualy suggest code changes instead of my 8ball comments

@BastiaanOlij
Copy link
Member Author

Hmm, I wonder why its that much more stable for me and what I've missed.
Turning and moving shouldn't have an effect anymore because we no longer apply the weight simulation. Same with teleport.
So there must be some scenarios where we're getting some oscillation.

Malcolm also noticed that because we're now properly testing for collisions, we're getting into trouble when we attach items to snap zones that bring collisions close to the hands, such as adding the scope to the gun.

@DigitalN8m4r3
Copy link
Contributor

Hmm, I wonder why its that much more stable for me and what I've missed. Turning and moving shouldn't have an effect anymore because we no longer apply the weight simulation. Same with teleport. So there must be some scenarios where we're getting some oscillation.

Malcolm also noticed that because we're now properly testing for collisions, we're getting into trouble when we attach items to snap zones that bring collisions close to the hands, such as adding the scope to the gun.

indeed, its a hornets Nest..
what i have noticed is that indeed the interactables on the sniper are malfunctioning most of the time, just not when the sniper is hoizontal from the side.

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 this pull request may close these issues.

2 participants