Yellow-Dog-Man / Resonite-Issues

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

Add ability to check if something is grabbed by the laser #1500

Open Lexevolution opened 7 months ago

Lexevolution commented 7 months ago

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

I would like to create an item that reacts differently whether it is grabbed by hand or by a laser. I can't seem to find a way to distinguish between these.

Describe the solution you'd like

I would like two protoflux nodes:

Describe alternatives you've considered

This is extremely unconventional and not 100% accurate.

Additional Context

No response

Requesters

Lexevo epicEaston197

shiftyscales commented 7 months ago

You could make use of two grabbable components- one with AllowOnlyPhysicalGrab enabled, one with it disabled. Assign the one with it disabled a lower grab priority. This will mean that when physically grabbing it would use the first grabbable component, when laser/remote grabbing it would use the second component. You could then make use of the existing ProtoFlux nodes to determine which grabbable was grabbed and divert your logic accordingly, @Lexevolution.

Lexevolution commented 7 months ago

Interesting method! This would work well for making an item react differently. Thank you!

Maybe I should've added to the "related to a problem" section. Where a feature for an avatar that would have its eyes glow when grabbing anything with a laser, to make it look like the user has "magical abilities". This would require the second protoflux node I mentioned, and the method you mentioned would not work for this scenario.

shiftyscales commented 7 months ago

Well- in that case- for now, you could check the local position of the Holder slot under the Grabber in the GrabArea Anchor (optionally alongside the presence of a child slot). When remote grabbing the Holder moves out to the object, @Lexevolution.

It wouldn't be as stable an option as something more dedicated- but I'm pretty sure it'd work as requested.

Frooxius commented 7 months ago

I would actually advise against doing this, because this is relying on implementation detail, which can change at some point in time - unless you're okay with that breakage

We could add a mechanism to determine the type of grab for a given grabbable, it's not a big ask.

shiftyscales commented 7 months ago

The request in this case was for a way of determining on the avatar/user which type of grab is being used (e.g. for any arbitrary grabbable object), @Frooxius.

And yes- I also don't recommend doing that method either- hence my mention it's not a stable solution.

Frooxius commented 7 months ago

@shiftyscales Yes, that's what I understood this request as.

shiftyscales commented 7 months ago

Okay- I misunderstood your response. "For a given grabbable" sounded like it was for a particular object that had been set up in a particular way. Sorry.

Lexevolution commented 7 months ago

The reason I was asking for two protoflux nodes is because I was asking for both a way to check whether a specific grabbable is being grabbed by the laser, which would need to have that object specifically set up for it. As well as whether the user is grabbing any arbitrary object using their laser, which would be something that could be set up on an avatar.

These nodes would likely be mutually exclusive by nature, as I don't see a reason to put both on an object (maybe if someone is picked up?).

Frooxius commented 7 months ago

We can add both. In the FrooxEngine terminology, there are two grab types:

We can add two nodes where the output is the type of the grab for either: