Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
135 stars 2 forks source link

Node to determine Chiriality based on an input slot. #2229

Open LeCloutPanda opened 4 months ago

LeCloutPanda commented 4 months ago

Is your feature request related to a problem? Please describe.

There have been multiple times where I needed to determine what chirality a slot is parented under to do different things and the latest one is trying to determine if an item is left/right handed.

Describe the solution you'd like

A node that takes a slot input and tries to determine what side it is parented under and if it can't determine what side it is under then it returns -1.

image

Describe alternatives you've considered

Using flux nodes to write a side when On Grabbable Grabbed or On Grabbable Released is called combined with a detection to see what hand is closest to the object when it writes but this leads to the issue of if I want it to be the left side but my right hand is closer it will write it as right rather than left.

Example of what I currently am doing image

Additional Context

Determining what side wouldn't be easy but having it look for stuff like AvatarPoseNode and seeing what node it is for such as LeftHand or RightHand or HandPoser side. There must be other ways too but I can't think of any at the moment.

There was an issue for it here https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/1805 that would have been the solution because if I could get the closest body node slot from proxy I could then check to see if the object I was using was a child of the proxy/where ever it is parented under.

Requesters

LeCloutPanda (Discord)

shiftyscales commented 4 months ago

Can you please give more context of the underlying problem you're trying to solve/what you're trying to build, @LeCloutPanda?

You can already determine the chirality of which side something is being grabbed with.

image

Frooxius commented 4 months ago

Slots don't really have any inherent Chirality property so this isn't something we could expose directly.

There's a few systems that do have that concept, but I don't quite understand what use-cases are you going for this, because you might care about some systems and not others.

Are you looking specifically for which hand is the Slot under? Or something else?

shiftyscales commented 4 months ago

There are also nodes that let you get the chirality of a body node too if you're looking to have it parented to a part of the avatar's body.

image

LeCloutPanda commented 4 months ago

Slots don't really have any inherent Chirality property so this isn't something we could expose directly.

There's a few systems that do have that concept, but I don't quite understand what use-cases are you going for this, because you might care about some systems and not others.

Are you looking specifically for which hand is the Slot under? Or something else?

I am trying to determine what hand side the object is parented under for my specific use case I want to determine what should show on a object if it is in the left and then the opposite on the right.

LeCloutPanda commented 4 months ago

There are also nodes that let you get the chirality of a body node too if you're looking to have it parented to a part of the avatar's body.

image

I know there are nodes for this but BodyNode doesn't have options for Proxies outlined in https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/1805 if I were able to get the proxy slots consistently this feature wouldn't be needed as I would just get the proxy and check if the slot I am trying to check is a child of the proxy and then I could use the Body Node Chirality node to determine what side it is.

5H4D0W-X commented 4 months ago

Maybe a "closest body node" node could be better and more flexible for this, which takes a slot, walks up the hierarchy until it finds a body node slot (such as a hand or foot) with a chirality and returns that.

ultrawidegamer commented 4 months ago

The main problem is because its a head and hands avatar. Resonite doesnt think the hands (or the head) proxies are a body node slot. We need a way of getting the proxies of an avatar and not just the body node slots at the root of the avatar.

art0007i commented 4 months ago

Another usecase for this kind of node is to figure out whether a user clicked a button using their left or right hand. The button events node outputs the component that caused the event, from which you can get a slot but after that trying to figure out which hand that slot belongs to is difficult.

JackTheFoxOtter commented 4 months ago

I am not sure how a good solution to this would look like, but I agree that this generally would be useful. In the past, I've needed to figure out what hand a user was using when clicking a button, and used Nearest User Hand of the Slot of the source component from the button interaction, which works, but isn't very elegant in my opinion.

An avatar-agnostic way to associate a slot with a body node or chirality would be very appreciated. Until then, maybe this approach can be helpful to people. It does a spatial query and could theoretically fail if another user's hand is closer though.

image

LeCloutPanda commented 4 months ago

The issue I am having is that if i grab with my right hand but I need the object to be parented to the left hand and display stuff as if it was the left side then getting the current chirality of the grabbable will just return the right hand rather then what side it is parented under, I have tried doing distance checks to see what side was closest but that then leads to bugs where if my right hand is closer to the object when it gets attached to the left side it thinks it is a right sided object.

image

Another issue is that BodyNodes don't have options for proxies and if a user is a head and hands avatar the body node slots return the UserRoot ones rather than the AvatarRoot, I can solve this by trying to find the proxies but that leads to inconsistency as not everyone names their proxies "x proxy" etc.

As Shadow mentioned if we had a node that went up the hierarchy and finds the closest node for example the proxies have nodes that tells what proxy it is shown below but we can't through flux find this component/slot. image