intelvwi / DSG

Distributed Scene Graph
20 stars 13 forks source link

Making an object physical from client manager, viewer does not receive prim updates #15

Closed dslake closed 11 years ago

dslake commented 11 years ago

Steps to reproduce this problem:

  1. Build a prim on client manager.
  2. Move it a few meters above the ground
  3. Click the checkbox to make it physical
  4. Unselect the prim.

The prim should fall to the terrain but it appears to stay hovering. By selecting the prim again and editing the rotation, an update will be received that shows the prim really is on the ground. The same can be done by walking through the prim. It will not appear to move, but updating the rotation will make it snap to its actual location as seen by the physics engine.

dslake commented 11 years ago

Some troubleshooting showed that the physics engine scene object is not properly subscribing to the event that reports tainted physical objects. The code looks like this in SceneObjectPart.cs

pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate

That is getting called on the client manager and on the persistence simulator but not on the physics simulator. Looking into SceneObjectPart.DoPhysicsPropertyUpdate() shows that the object appears to already be set physical by the time the subscription would be made so it's ignored. That may be because we are synchronizing the PrimFlags field of the SceneObjectPart and also synchronizing the IsPhysical field of the PhysicsActor. If the IsPhysical flag gets set on the PhysicsActor before the PrimFlags are synchronized, then the subscription will be skipped and updates will not flow to the DSG module or even to the clients connected locally to the physics simulator.

dslake commented 11 years ago

Removing the synchronization of IsPhysical and letting the PrimFlags side effects happen (one of which is to set IsPhysical) fixes the problem. This is a general issue that some property changes cause other properties to be changed, but only if other certain conditions or ordering is met. This fixes this particular test case but likely causes something else to not work now. We'll see.