Forum Discussion
grindinggear
1 year agoHonored Guest
How to snap object in multiplayer Unity Netcode?
I'm using SnapInteractor to snap object to another , and how can i use it in multiplayer with netcode ? How to let all clients see that object is snapped to another ? So far the object just move with...
- 1 year ago
I dont think there is an easy solution to this. We did a similar functionallity where each snapInteractor has a networked boolean isOccupied. When a client snaps an object somewhere, this isOccupied becomes true and you can subscribe a method to this state change for all clients to run. e.g. disable all colliders so that no one can grab the grabbable (snapInteractable) anymore.
Probably the method you are searching for is this series of calls:snapInteractor.SetComputeShouldSelectOverride(() => true, true);snapInteractor.SetComputeCandidateOverride(() => snapInteractable, true);snapInteractor.Select();
but you should know you must have ownership and you must somehow find the snapInteractable in order to give it to SetComputeCandidateOverride()
giorgos.ganias
1 year agoExplorer
I dont think there is an easy solution to this. We did a similar functionallity where each snapInteractor has a networked boolean isOccupied. When a client snaps an object somewhere, this isOccupied becomes true and you can subscribe a method to this state change for all clients to run. e.g. disable all colliders so that no one can grab the grabbable (snapInteractable) anymore.
Probably the method you are searching for is this series of calls:
snapInteractor.SetComputeShouldSelectOverride(() => true, true);
snapInteractor.SetComputeCandidateOverride(() => snapInteractable, true);
snapInteractor.Select();
but you should know you must have ownership and you must somehow find the snapInteractable in order to give it to SetComputeCandidateOverride()
but you should know you must have ownership and you must somehow find the snapInteractable in order to give it to SetComputeCandidateOverride()
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
- 1 year ago
- 3 years ago
- 3 months ago