lechiM123 Posted December 4, 2021 Share Posted December 4, 2021 Hello, I am currently working on a Multiplayer Unity VR Project where I want to let two players be able to grab an object. For the Networking I use Mirror. The first Demo is a simple Basketball Scene, in which two players should be able to access the same ball and throw it. The Ball has a Basic Grabbable Component attached to it. The game works in Singleplayer. But for the Multiplayer I do not really understand which calls/variables/methods etc. I need to synchronize for all players to be able to grab and move the ball. Do I need to alter the Basic Grabbable Script? The "dirty" solution I thought of was to set a Transform Constraint on the Ball, upon the "After Grabbed (Basic Grabbable)" event being fired. This transform would then be synced. But then I would Ignore all the behaviour the grabbing should have from the Basic Grabbable Script. Thanks! Link to comment Share on other sites More sharing options...
dario Posted December 16, 2021 Share Posted December 16, 2021 hi @lechiM123 Were you able to find helpful info on the Mirror forums or general Unity forums for details on multiplayer synching in general? Depending on how multiplayer is implemented you may or may not have to edit the Basic Grabble VIU script. We will try to follow up with a networking example at some point (we've been meaning to for some time).but we're not that familiar with Mirror but we'll take a look - generally this forum discusses VIU specific issues so again I would recommend the other forums. But if you've made progress certainly report back here. Again it depends on the multiplayer framework, but we'll try to generally advise on how grabbles can handle networked events. I would also suggest taking a look at how other networking solutions work with other toolkits e.g. using 'interactables' vs 'grabbables'. Link to comment Share on other sites More sharing options...
lawwong Posted December 16, 2021 Share Posted December 16, 2021 Yes, BasicGrabbable is derived from GrabbableBase, and is designed to be able to be easily overridden with customized grabbing condition. The abstract class "GrabbableBase" allows transform to track attached grabbers: - GrabbableBase.AddGrabber(grabber) : attach a grabber, then transform will keep tracking to the grabber's pose. Adding multiple grabbers is allowed, but only the last 1 or 2 added grabbers effect the tracking pose. - GrabbableBase.RemoveGrabber(grabber) : detach a grabber. - GrabbableBase.ClearGrabbers() : detach all grabbers. BasicGrabbable is only a shell that controls adding/removing grabbers whenever a grabber is close enough and demand button is pressed (ColliderEvent). Due to networking game often involves controlling and synchronizing who can move or who is moving the ball, you may need to either rewrite or override BasicGrabbable with some synced condition and network command, depends on your gameplay and the networking framework you are using. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now