Forum Discussion
moritz
1 year agoExplorer
How to get the Interactor of Interactable (Controllers)
Hi everybody,
does anybody know how to get the selecting Interactor of an Interactable?
I tried basically everything and am sure that there is a simple way to do this but I could not find it.
When looking into the Meta SDK Doc it says that one should use the Data Property, however the script in that "tutorial" is simply wrong, since following line throws an InvalidCastException: Specified cast is not valid.
HandRef handData = (HandRef)pointerEvent.Data;
I've seen that there is the IsGrabbing() Method for HandGrabbing, which of course would be great, however it doesn't exist for the controllers.
If anyone has done this (which I guess someone must have done that, right? I still couldn't find anything about that), any help is greatly appreciated!
1 Reply
Replies have been turned off for this discussion
- MoMonayMHCP Member
The example in the docs doesn't work indeed. You can also use the identifier in the pointerEvent and compare it with the identifiers of interactors.
public Interactor leftHandGrabInteractor; public Interactor rightHandGrabInteractor; public void HandGrabbed(PointerEvent pointerEvent) { if (pointerEvent.Identifier == leftHandGrabInteractor.Identifier) { //left hand grabbed, use leftHandGrabInteractor } if (pointerEvent.Identifier == rightHandGrabInteractor.Identifier) { //right hand grabbed, use rightHandGrabInteractor } }Source: https://developers.meta.com/horizon/documentation/unity/unity-isdk-pointer-events
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 2 years ago