Synchronizing Physical Properties of EntityEquipment in TableTopKi

I am working on adding synchronized physical properties to EntityEquipment in TableTopKit, allowing seamless coordination during GroupActivities sessions between players.

Current Approach and Limitations

I have tried setting EntityEquipment's state to DieState and treating it as a TossableRepresentation object. This approach achieves basic physical properties synchronized across players. However, it has several limitations:

  1. No Collision Detection Between Dice: Multiple dice do not collide with each other.
  2. Shape Limitations: Custom shapes, like parallelepipeds, cannot be configured.

Below is my existing code for Base Entity Equipment without physical properties:

struct CubeWithPhysics: EntityEquipment {
    let id: ID
    let entity: Entity
    var initialState: BaseEquipmentState

    init(id: ID, entity: Entity) {
        self.id = id
        self.entity = entity
        initialState = .init(parentID: .tableID, pose: .init(position: .zero, rotation: .zero), entity: self.entity)
    }
}

I’d appreciate any guidance on the recommended approach to adding synchronized physical properties to EntityEquipment.

Answered by matt_novoselov in 815730022

We have provided one of the possible solutions that we have found in this thread:

Synchronizing Physics in TableTopKit

Same issue there!

Second Failed Approach

I also tried adding PhysicsBodyComponent and CollisionComponent to EntityEquipment's Entity. This approach provides proper physics collisions and custom shapes. However, the main issue is that the position of EntityEquipment itself does not synchronize with the Entity's physics body, resulting in two separate instances of one object.

im having the same problem

I'm having the same issue here! Still don't know how to resolve it :(

Accepted Answer

We have provided one of the possible solutions that we have found in this thread:

Synchronizing Physics in TableTopKit

Synchronizing Physical Properties of EntityEquipment in TableTopKi
 
 
Q