* Change the order of Update so Physics processes a frame before the scene manipulates the physics Scene.cs
* Remove the draconic locking around adding an avatar to the Scene * Handle an extreme error case when border crossing fails and user uses map to teleport to a different region on the same instance causing control commands to go to a child agent. * Make the Set Appearance method use the proper 'remove from physics scene' method. * It *may* help border crossings. * It *may* help the 'on avatar rez' lag, that people have been seeing the past week. * It may also cause physics to crash more often on failed teleports (though.. I think I got the cases covered).trunk
parent
01446074b1
commit
f74622c65f
|
@ -901,24 +901,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (m_frame == Int32.MaxValue)
|
if (m_frame == Int32.MaxValue)
|
||||||
m_frame = 0;
|
m_frame = 0;
|
||||||
|
|
||||||
physicsMS2 = Environment.TickCount;
|
|
||||||
if ((m_frame % m_update_physics == 0) && m_physics_enabled)
|
|
||||||
m_sceneGraph.UpdatePreparePhysics();
|
|
||||||
physicsMS2 = Environment.TickCount - physicsMS2;
|
|
||||||
|
|
||||||
if (m_frame % m_update_entitymovement == 0)
|
|
||||||
m_sceneGraph.UpdateEntityMovement();
|
|
||||||
|
|
||||||
physicsMS = Environment.TickCount;
|
|
||||||
if ((m_frame % m_update_physics == 0) && m_physics_enabled)
|
|
||||||
physicsFPS = m_sceneGraph.UpdatePhysics(
|
|
||||||
Math.Max(SinceLastFrame.TotalSeconds, m_timespan)
|
|
||||||
);
|
|
||||||
if (m_frame % m_update_physics == 0 && SynchronizeScene != null)
|
|
||||||
SynchronizeScene(this);
|
|
||||||
|
|
||||||
physicsMS = Environment.TickCount - physicsMS;
|
|
||||||
physicsMS += physicsMS2;
|
|
||||||
|
|
||||||
otherMS = Environment.TickCount;
|
otherMS = Environment.TickCount;
|
||||||
// run through all entities looking for updates (slow)
|
// run through all entities looking for updates (slow)
|
||||||
|
@ -949,6 +932,25 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (m_frame % m_update_presences == 0)
|
if (m_frame % m_update_presences == 0)
|
||||||
m_sceneGraph.UpdatePresences();
|
m_sceneGraph.UpdatePresences();
|
||||||
|
|
||||||
|
physicsMS2 = Environment.TickCount;
|
||||||
|
if ((m_frame % m_update_physics == 0) && m_physics_enabled)
|
||||||
|
m_sceneGraph.UpdatePreparePhysics();
|
||||||
|
physicsMS2 = Environment.TickCount - physicsMS2;
|
||||||
|
|
||||||
|
if (m_frame % m_update_entitymovement == 0)
|
||||||
|
m_sceneGraph.UpdateEntityMovement();
|
||||||
|
|
||||||
|
physicsMS = Environment.TickCount;
|
||||||
|
if ((m_frame % m_update_physics == 0) && m_physics_enabled)
|
||||||
|
physicsFPS = m_sceneGraph.UpdatePhysics(
|
||||||
|
Math.Max(SinceLastFrame.TotalSeconds, m_timespan)
|
||||||
|
);
|
||||||
|
if (m_frame % m_update_physics == 0 && SynchronizeScene != null)
|
||||||
|
SynchronizeScene(this);
|
||||||
|
|
||||||
|
physicsMS = Environment.TickCount - physicsMS;
|
||||||
|
physicsMS += physicsMS2;
|
||||||
|
|
||||||
// Delete temp-on-rez stuff
|
// Delete temp-on-rez stuff
|
||||||
if (m_frame % m_update_backup == 0)
|
if (m_frame % m_update_backup == 0)
|
||||||
CleanTempObjects();
|
CleanTempObjects();
|
||||||
|
|
|
@ -870,14 +870,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (PhysicsActor != null)
|
if (PhysicsActor != null)
|
||||||
{
|
{
|
||||||
lock (m_scene.SyncRoot)
|
m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
|
||||||
{
|
m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
|
||||||
m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
|
m_physicsActor.UnSubscribeEvents();
|
||||||
m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
|
m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
|
||||||
m_physicsActor.UnSubscribeEvents();
|
PhysicsActor = null;
|
||||||
m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
|
|
||||||
PhysicsActor = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -999,7 +996,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
internal void SetHeight(float height)
|
internal void SetHeight(float height)
|
||||||
{
|
{
|
||||||
m_avHeight = height;
|
m_avHeight = height;
|
||||||
if (PhysicsActor != null)
|
if (PhysicsActor != null && !IsChildAgent)
|
||||||
{
|
{
|
||||||
PhysicsVector SetSize = new PhysicsVector(0.45f, 0.6f, m_avHeight);
|
PhysicsVector SetSize = new PhysicsVector(0.45f, 0.6f, m_avHeight);
|
||||||
PhysicsActor.Size = SetSize;
|
PhysicsActor.Size = SetSize;
|
||||||
|
@ -2219,7 +2216,35 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (m_isChildAgent)
|
if (m_isChildAgent)
|
||||||
{
|
{
|
||||||
m_log.Debug("DEBUG: AddNewMovement: child agent");
|
m_log.Debug("DEBUG: AddNewMovement: child agent, Making root agent!");
|
||||||
|
|
||||||
|
// we have to reset the user's child agent connections.
|
||||||
|
// Likely, here they've lost the eventqueue for other regions so border
|
||||||
|
// crossings will fail at this point unless we reset them.
|
||||||
|
|
||||||
|
List<ulong> regions = new List<ulong>(KnownChildRegionHandles);
|
||||||
|
regions.Remove(m_scene.RegionInfo.RegionHandle);
|
||||||
|
|
||||||
|
MakeRootAgent(new Vector3(127, 127, 127), true);
|
||||||
|
|
||||||
|
// Async command
|
||||||
|
if (m_scene.SceneGridService != null)
|
||||||
|
{
|
||||||
|
m_scene.SceneGridService.SendCloseChildAgentConnections(UUID, regions);
|
||||||
|
|
||||||
|
// Give the above command some time to try and close the connections.
|
||||||
|
// this is really an emergency.. so sleep, or we'll get all discombobulated.
|
||||||
|
System.Threading.Thread.Sleep(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (m_scene.SceneGridService != null)
|
||||||
|
{
|
||||||
|
m_scene.SceneGridService.EnableNeighbourChildAgents(this, new List<RegionInfo>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2554,11 +2579,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (m_physicsActor != null)
|
if (m_physicsActor != null)
|
||||||
{
|
{
|
||||||
// This may seem like it's redundant, remove the avatar from the physics scene
|
if (!IsChildAgent)
|
||||||
// just to add it back again, but it saves us from having to update
|
{
|
||||||
// 3 variables 10 times a second.
|
// This may seem like it's redundant, remove the avatar from the physics scene
|
||||||
m_scene.PhysicsScene.RemoveAvatar(m_physicsActor);
|
// just to add it back again, but it saves us from having to update
|
||||||
AddToPhysicalScene(m_physicsActor.Flying);
|
// 3 variables 10 times a second.
|
||||||
|
bool flyingTemp = m_physicsActor.Flying;
|
||||||
|
RemoveFromPhysicalScene();
|
||||||
|
//m_scene.PhysicsScene.RemoveAvatar(m_physicsActor);
|
||||||
|
|
||||||
|
//PhysicsActor = null;
|
||||||
|
|
||||||
|
AddToPhysicalScene(flyingTemp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_appearance.SetAppearance(texture, visualParam);
|
m_appearance.SetAppearance(texture, visualParam);
|
||||||
if (m_appearance.AvatarHeight > 0)
|
if (m_appearance.AvatarHeight > 0)
|
||||||
|
@ -3188,30 +3221,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void AddToPhysicalScene(bool isFlying)
|
public void AddToPhysicalScene(bool isFlying)
|
||||||
{
|
{
|
||||||
lock (m_scene.SyncRoot)
|
|
||||||
|
PhysicsScene scene = m_scene.PhysicsScene;
|
||||||
|
|
||||||
|
PhysicsVector pVec =
|
||||||
|
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
|
||||||
|
AbsolutePosition.Z);
|
||||||
|
|
||||||
|
// Old bug where the height was in centimeters instead of meters
|
||||||
|
if (m_avHeight == 127.0f)
|
||||||
{
|
{
|
||||||
PhysicsScene scene = m_scene.PhysicsScene;
|
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f),
|
||||||
|
isFlying);
|
||||||
PhysicsVector pVec =
|
|
||||||
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
|
|
||||||
AbsolutePosition.Z);
|
|
||||||
|
|
||||||
if (m_avHeight == 127.0f)
|
|
||||||
{
|
|
||||||
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f),
|
|
||||||
isFlying);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec,
|
|
||||||
new PhysicsVector(0, 0, m_avHeight), isFlying);
|
|
||||||
}
|
|
||||||
scene.AddPhysicsActorTaint(m_physicsActor);
|
|
||||||
//m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
|
|
||||||
m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
|
|
||||||
m_physicsActor.SubscribeEvents(1000);
|
|
||||||
m_physicsActor.LocalID = LocalId;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec,
|
||||||
|
new PhysicsVector(0, 0, m_avHeight), isFlying);
|
||||||
|
}
|
||||||
|
scene.AddPhysicsActorTaint(m_physicsActor);
|
||||||
|
//m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
|
||||||
|
m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
|
||||||
|
m_physicsActor.SubscribeEvents(1000);
|
||||||
|
m_physicsActor.LocalID = LocalId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event called by the physics plugin to tell the avatar about a collision.
|
// Event called by the physics plugin to tell the avatar about a collision.
|
||||||
|
|
Loading…
Reference in New Issue