Yellow-Dog-Man / Resonite-Issues

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

Expose IsTracking to Controller ProtoFlux nodes #3075

Open TW1STaL1CKY opened 2 days ago

TW1STaL1CKY commented 2 days ago

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

For what I'm trying to make on my avatar, I want to be able to determine whether my VR controller is turned on through ProtoFlux. I assumed "IsActive" on the StandardController (and IndexController etc) node would correspond to this, however turning off my controller continues to report it as active as it freezes my hand in place. I then checked if "BatteryLevel" would reflect it better, but that value freezes when the controller is turned off too. This lead me to search for any other ProtoFlux nodes that would report whether a controller is on or is tracking, but no dice.

I did some digging through the user root nodes and found a field on the Left/RightController's TrackedDevicePositioner component named "IsTracking", which does toggle on and off corresponding to whether the controller is turned on (and of course, whether it can be seen for tracking).

While writing this, I found a workaround which was to add a TrackedDevicePositioner component of my own somewhere on the avatar. By setting the body node to either the left or right controller, its "IsTracking" field updates automatically and I can then use that as a source. I'm not sure if having this extra component will have any side effects on my avatar's tracking, but either way, it would be much nicer and simpler if this value was available through a ProtoFlux node.

Another way I was suggested was ref hacking... I would rather not have to resort to that route, and I hope noone else would need to resort to that either :v

Describe the solution you'd like

Please can a new boolean output be added to all Controller ProtoFlux nodes called "IsTracking" which acts the same as the field on the TrackedDevicePositioner component?

The nodes this would be added onto:

Describe alternatives you've considered

An alternative could be a "IsControllerTurnedOn" Standard(etc)Controller node output? Or as an entirely new ProtoFlux node?

Additional Context

No response

Requesters

TW1STaL1CKY

shiftyscales commented 18 hours ago

For what I'm trying to make on my avatar

What are you trying to make on your avatar, @TW1STaL1CKY? Having additional context for what you're trying to make would make it easier to determine what the best solution / path to achieving that would be.

It doesn't seem like an unreasonable request in any case- we expose other device properties like the presence sensor- this feels like it could fit in well with existing user nodes.

I think in this case though- it would be better implemented as a separate node that accepts a body node input, and outputs IsTracking - this would allow it to track all devices / trackers that can be assigned to any body node, e.g. headset tracking, FBT trackers, etc. and would be more generic / device agnostic rather than only handling controllers. It may also be useful for it to output IsActive and IsSimulated as well however since the locomotion animation system will set those devices as IsTracked even if simulated instead of with hardware tracking.

however turning off my controller continues to report it as active as it freezes my hand in place

This sounds like it may be a bug though? In the absence of a tracked device, the system should fall-back to the locomotion animation system to position the hand. Please report this separately in a new issue.

TW1STaL1CKY commented 13 hours ago

What are you trying to make on your avatar

I'm adding Flux to my avatar so when a controller turns off (eg. by running out of battery) while in VR, it scales down that side's upperarm to make the whole arm disappear.

I have the "is in VR" part down by using the User is Present in Headset node. Detecting the controller being truly active is what I couldn't do.

I think in this case though- it would be better implemented as a separate node that accepts a body node input, and outputs IsTracking - this would allow it to track all devices / trackers that can be assigned to any body node, e.g. headset tracking, FBT trackers, etc. and would be more generic / device agnostic rather than only handling controllers.

You're right, that sounds a lot more useful 😄 Having IsActive and IsSimulated also available as outputs would be nice, especially IsSimulated.

This sounds like it may be a bug though? In the absence of a tracked device, the system should fall-back to the locomotion animation system to position the hand. Please report this separately in a new issue.

Sure thing, I can report it next time I'm in the game so I can test it some more and get the relevant info.

Thank you!