From 2afbf8b22b1548c7994981acf92882c6d9628bb9 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Wed, 19 Sep 2007 04:19:27 +0000 Subject: * Added AddToPhysicalScene and RemoveFromPhysicalScene and added to MakeAvatar and MakeChildAgent respectively * Removed unused m_child from ClientView --- OpenSim/Region/Environment/Scenes/Scene.cs | 10 ++----- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 35 +++++++++++++++++----- 2 files changed, 30 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index df125aa..3a45e23 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -706,7 +706,9 @@ namespace OpenSim.Region.Environment.Scenes { SubscribeToClientEvents(client); m_estateManager.sendRegionHandshake(client); + CreateAndAddScenePresence(client, child); + m_LandManager.sendParcelOverlay(client); commsManager.UserProfiles.AddNewUser(client.AgentId); commsManager.TransactionsManager.AddUser(client.AgentId); @@ -791,13 +793,7 @@ namespace OpenSim.Region.Environment.Scenes MainLog.Instance.Verbose(RegionInfo.RegionName + ": Creating new root agent."); MainLog.Instance.Verbose(RegionInfo.RegionName + ": Adding Physical agent."); - PhysicsVector pVec = - new PhysicsVector(newAvatar.AbsolutePosition.X, newAvatar.AbsolutePosition.Y, - newAvatar.AbsolutePosition.Z); - lock (m_syncRoot) - { - newAvatar.PhysActor = phyScene.AddAvatar(pVec); - } + newAvatar.AddToPhysicalScene( ); } lock (Entities) diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 64c6eaa..811c962 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -265,17 +265,17 @@ namespace OpenSim.Region.Environment.Scenes } } - /// - /// - /// - /// public void MakeAvatar(LLVector3 pos, bool isFlying) { - //this.childAvatar = false; - AbsolutePosition = pos; - _physActor.Flying = isFlying; newAvatar = true; childAgent = false; + + AbsolutePosition = pos; + + AddToPhysicalScene( ); + _physActor.Flying = isFlying; + + m_scene.SendAllSceneObjectsToClient(this); } @@ -283,9 +283,17 @@ namespace OpenSim.Region.Environment.Scenes { Velocity = new LLVector3(0, 0, 0); childAgent = true; + + RemoveFromPhysicalScene(); + //this.Pos = new LLVector3(128, 128, 70); } + private void RemoveFromPhysicalScene() + { + m_scene.phyScene.RemoveAvatar( this.PhysActor ); + } + /// /// /// @@ -832,7 +840,18 @@ namespace OpenSim.Region.Environment.Scenes public override void SetText(string text, Vector3 color, double alpha) { - throw new Exception("The method or operation is not implemented."); + throw new Exception("Can't set Text on avatar."); + } + + public void AddToPhysicalScene( ) + { + PhysicsScene scene = m_scene.phyScene; + + PhysicsVector pVec = + new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, + AbsolutePosition.Z); + + _physActor = scene.AddAvatar(pVec); } } } \ No newline at end of file -- cgit v1.1