From 0feb5da31e0986d46ea06ffb9804cf30f700e119 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 13 Aug 2013 21:06:24 -0700 Subject: BulletSim: move the creation of the avatar movement actor creating to taint time. Attempt to fix a problem of teleporting within the same region where the remove and addition of the physical avatar occasionally ends up with a non-moving avatar. --- OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index d584782..502f85f 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs @@ -89,13 +89,6 @@ public sealed class BSCharacter : BSPhysObject // set _avatarVolume and _mass based on capsule size, _density and Scale ComputeAvatarVolumeAndMass(); - // The avatar's movement is controlled by this motor that speeds up and slows down - // the avatar seeking to reach the motor's target speed. - // This motor runs as a prestep action for the avatar so it will keep the avatar - // standing as well as moving. Destruction of the avatar will destroy the pre-step action. - m_moveActor = new BSActorAvatarMove(PhysScene, this, AvatarMoveActorName); - PhysicalActors.Add(AvatarMoveActorName, m_moveActor); - DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5},pos={6}", LocalID, _size, Scale, Density, _avatarVolume, RawMass, pos); @@ -106,6 +99,13 @@ public sealed class BSCharacter : BSPhysObject // New body and shape into PhysBody and PhysShape PhysScene.Shapes.GetBodyAndShape(true, PhysScene.World, this); + // The avatar's movement is controlled by this motor that speeds up and slows down + // the avatar seeking to reach the motor's target speed. + // This motor runs as a prestep action for the avatar so it will keep the avatar + // standing as well as moving. Destruction of the avatar will destroy the pre-step action. + m_moveActor = new BSActorAvatarMove(PhysScene, this, AvatarMoveActorName); + PhysicalActors.Add(AvatarMoveActorName, m_moveActor); + SetPhysicalProperties(); }); return; -- cgit v1.1 From fd519748e9c828e03468dc61b331115f07b3fadd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 14 Aug 2013 19:35:02 +0100 Subject: Add method doc to Scene.RemoveClient() to ask any callers to use Scene.IncomingCloseAgent() instead. IncomingCloseAgent() now sets the scene presence state machine properly, which is necessary to avoid races between multiple sources of close. Hence, it's also necessary for everyone to consistently call IncomingCloseAgent() Calling RemoveClient() directly is currently generating an attention-grabbing exception though this right now this is harmless. --- OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++++++++ OpenSim/Region/Framework/Scenes/SceneBase.cs | 13 +++++++++++++ 2 files changed, 25 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a3bd388..d187377 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3382,6 +3382,18 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Remove the given client from the scene. + /// + /// + /// Only clientstack code should call this directly. All other code should call IncomingCloseAgent() instead + /// to properly operate the state machine and avoid race conditions with other close requests (such as directly + /// from viewers). + /// + /// ID of agent to close + /// + /// Close the neighbour child agents associated with this client. + /// public override void RemoveClient(UUID agentID, bool closeChildAgents) { AgentCircuitData acd = m_authenticateHandler.GetAgentCircuitData(agentID); diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index d2097ea..5252b96 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -217,6 +217,19 @@ namespace OpenSim.Region.Framework.Scenes #region Add/Remove Agent/Avatar public abstract ISceneAgent AddNewClient(IClientAPI client, PresenceType type); + + /// + /// Remove the given client from the scene. + /// + /// + /// Only clientstack code should call this directly. All other code should call IncomingCloseAgent() instead + /// to properly operate the state machine and avoid race conditions with other close requests (such as directly + /// from viewers). + /// + /// ID of agent to close + /// + /// Close the neighbour child agents associated with this client. + /// public abstract void RemoveClient(UUID agentID, bool closeChildAgents); public bool TryGetScenePresence(UUID agentID, out object scenePresence) -- cgit v1.1