How to express in some serialization, the relationship of how one object is parented to another?

I have a networked VR experience in which players can grab objects using their controllers by intersecting a mesh and squeezing the grip.

In the browser of player A, I parent the grabbed object B, to player A’s hand using something like:


When this happens I need to broadcast an event to all the other players that player A has grabbed object B so that each of the other players can also do that parenting in their respective browsers. I’m trying to figure out what schema to use for the message:

If I do { object_id: "object B", grabbed_by: "player A left hand" }, the receiving browser only knows it should parent the grabbed thing into the correct mesh, but it doesn’t know what the precise positions, rotations, offset are to maintain the exact same parent/child relationship as the event source. If player A is grabbing object B in a certain way, I want all other clients to reproduce the parenting relationship/grabbed angle etc in the exact same way.

Grabbing an object is flexible. For example a stick can be grabbed anywhere, at the middle, at the end, at any angle, and you can hand it from one hand to another etc.

I can send the positions and rotations of both the hand doing the grabbing and the object being grabbed at precisely the time the controller grip is squeezed, leading to an event like this:

{ object_id: "object B", grabbed_by: "player A left hand", hand_pos: [...], hand_rot: [...], obj_pos: [...], obj_rot: [...] },

which will work to capture the relationship between the parent and child, however I don’t quite like this solution because it expresses the relationship through an event in the past, rather than capturing the essence of the relationship. If a new player joins later and needs to know what each player is holding and how they are holding it, I would like to find a schema that efficiently describes those relationships without needing to express them in terms of former positions.

I feel like there is some kind of matrix or other value I can send to capture the essence between a parent and child, to help me parent things on the receiving clients, no matter where the hands are located at the time the message is received.

This is not some simple question. You are talking about how to engineer multiplayer 3d network packets.

It is probably best to spend time and do research in known stratergies for this. Just thinking about it without even having network coding experience I can say your idea of a packet is not ideal as you already pointed out … it lacks important information about the Transform ( translation , rotation and scale )

Also thinking from a network point of view, the kind of event that caused an update in a transform would not be linked to a transform packet itself. They actually have nothing to do with each other. One is used in game logic , the other is used to update geometry in the scene.

Nevermind about the networking scenario. What I was interested in was how parenting two objects is expressed in text. And I just took a look at how babylons serializer does it. I believe what it does is 1) provide the id of the parent 2) provide its position, rotation (and scale), in the parent’s space.