Improbable Icon

SpatialOS Discourse Forums

It would be great if the runtime used an optional ParentEntityId reference to calculate entity position

Hi,

I just wanted to offer some quick experience based feedback. We have found in a variety of cases that we would rather parent entities to one another than update lots of interrelated position components of entities that are moving together. If the SpatialOS Position component contained a Transform and ParentEntityId value, the runtime could consider the Transform value to be an offset from the parent, or if the parentId was negative it could simply treat the transform value as global. This would save a lot of bandwidth and greatly simplify design in a range of scenarios:

If a character is holding a range of equipment entities, rather than updating all of their position components and sending them all to the cloud to make sure that they stick together and have authority assigned to the same worker, it would make much more sense to set the equipment’s parent entity to the owner character entity and send just one position update.

In the case of rigid body trees, it would make the most sense to implement each joint as a chained entity with transform offsets. If we changed one transform value, we would then only need to send one small update to the cloud. In the current system, we need to maintain a global transform component for each joint. Changing one transform value then means updating and sending all dependent values. We could also implement the joints as transform types in a schema list, but updating one value then means resending the whole list to the cloud which also unnecessarily eats a lot of bandwidth.

Thanks!

Hey @joeys,

thanks for putting down this detailed feedback, we always welcome thoughts from our devs and community - very appreciated. I’ll pass this on to the team.

best,
Nee