From 7f2fdb80546d5c567d3a3028b1eb29ba4da7cea9 Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 15 May 2007 21:26:10 +0000 Subject: Added RemoveAvatar() method to physics plugins, should be called on log out (needs doing) and when downgrading a client to a child-avatar (should be working) --- OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 12 +++++++++++- OpenSim.Physics/Manager/PhysicsScene.cs | 7 +++++++ OpenSim.Physics/OdePlugin/OdePlugin.cs | 5 +++++ OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs | 5 +++++ OpenSim.RegionServer/world/Avatar.cs | 4 ++++ OpenSim.RegionServer/world/World.cs | 4 ++++ 6 files changed, 36 insertions(+), 1 deletion(-) diff --git a/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index d4515ca..ea2bd9b 100644 --- a/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs @@ -84,7 +84,17 @@ namespace OpenSim.Physics.BasicPhysicsPlugin _actors.Add(act); return act; } - + + public override void RemoveAvatar(PhysicsActor actor) + { + BasicActor act = (BasicActor)actor; + if(_actors.Contains(act)) + { + _actors.Remove(act); + } + + } + public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) { return null; diff --git a/OpenSim.Physics/Manager/PhysicsScene.cs b/OpenSim.Physics/Manager/PhysicsScene.cs index b79cc46..7dab4e1 100644 --- a/OpenSim.Physics/Manager/PhysicsScene.cs +++ b/OpenSim.Physics/Manager/PhysicsScene.cs @@ -44,6 +44,8 @@ namespace OpenSim.Physics.Manager public abstract PhysicsActor AddAvatar(PhysicsVector position); + public abstract void RemoveAvatar(PhysicsActor actor); + public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size); public abstract void Simulate(float timeStep); @@ -70,6 +72,11 @@ namespace OpenSim.Physics.Manager return PhysicsActor.Null; } + public override void RemoveAvatar(PhysicsActor actor) + { + + } + public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) { OpenSim.Framework.Console.MainConsole.Instance.WriteLine(LogPriority.VERBOSE, "NullPhysicsScene : AddPrim({0},{1})", position, size); diff --git a/OpenSim.Physics/OdePlugin/OdePlugin.cs b/OpenSim.Physics/OdePlugin/OdePlugin.cs index 4164d87..8ddfd5c 100644 --- a/OpenSim.Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim.Physics/OdePlugin/OdePlugin.cs @@ -131,6 +131,11 @@ namespace OpenSim.Physics.OdePlugin return newAv; } + public override void RemoveAvatar(PhysicsActor actor) + { + + } + public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) { PhysicsVector pos = new PhysicsVector(); diff --git a/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs index 10e92fe..dff1ee2 100644 --- a/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs @@ -121,6 +121,11 @@ namespace OpenSim.Physics.PhysXPlugin _characters.Add(act); return act; } + + public override void RemoveAvatar(PhysicsActor actor) + { + + } public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) { diff --git a/OpenSim.RegionServer/world/Avatar.cs b/OpenSim.RegionServer/world/Avatar.cs index f8a1a5a..c684c45 100644 --- a/OpenSim.RegionServer/world/Avatar.cs +++ b/OpenSim.RegionServer/world/Avatar.cs @@ -72,6 +72,10 @@ namespace OpenSim.world { this._physActor = value; } + get + { + return _physActor; + } } public override void addForces() diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs index e89f8f4..4dfe0e9 100644 --- a/OpenSim.RegionServer/world/World.cs +++ b/OpenSim.RegionServer/world/World.cs @@ -600,6 +600,10 @@ namespace OpenSim.world { Avatars.Remove(agentClient.AgentID); } + if (agentClient.ClientAvatar.PhysActor != null) + { + this.phyScene.RemoveAvatar(agentClient.ClientAvatar.PhysActor); + } } catch (Exception e) { -- cgit v1.1