From fe16dc09da3f2736fad5a9e792f5f81098b5f9a1 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 7 Apr 2013 08:27:49 -0700 Subject: BulletSim: complete movement of physical object action code out of the physical object and into actors for setForce, setTorque, hover, lock axis and avatar move. --- OpenSim/Region/Physics/BulletSPlugin/BSActors.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSActors.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs index 5a19ba4..fb4d452 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs @@ -32,12 +32,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin { public class BSActorCollection { - private BSScene PhysicsScene { get; set; } + private BSScene m_physicsScene { get; set; } private Dictionary m_actors; public BSActorCollection(BSScene physicsScene) { - PhysicsScene = physicsScene; + m_physicsScene = physicsScene; m_actors = new Dictionary(); } public void Add(string name, BSActor actor) @@ -61,6 +61,10 @@ public class BSActorCollection Release(); m_actors.Clear(); } + public void Dispose() + { + Clear(); + } public bool HasActor(string name) { return m_actors.ContainsKey(name); @@ -71,6 +75,10 @@ public class BSActorCollection act(kvp.Value); } + public void Enable(bool enabl) + { + ForEachActor(a => a.Enable(enabl)); + } public void Release() { ForEachActor(a => a.Dispose()); -- cgit v1.1 From a7a1b8b7e9269b446e3396a35153b00942c1e35b Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 7 Apr 2013 14:05:35 -0700 Subject: BulletSim: clean up actor code so routines use the same coding pattern. Fix a few enabling problems. --- OpenSim/Region/Physics/BulletSPlugin/BSActors.cs | 49 +++++++++++++++++------- 1 file changed, 35 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSActors.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs index fb4d452..12a8817 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs @@ -42,24 +42,36 @@ public class BSActorCollection } public void Add(string name, BSActor actor) { - m_actors[name] = actor; + lock (m_actors) + { + if (!m_actors.ContainsKey(name)) + { + m_actors[name] = actor; + } + } } public bool RemoveAndRelease(string name) { bool ret = false; - if (m_actors.ContainsKey(name)) + lock (m_actors) { - BSActor beingRemoved = m_actors[name]; - beingRemoved.Dispose(); - m_actors.Remove(name); - ret = true; + if (m_actors.ContainsKey(name)) + { + BSActor beingRemoved = m_actors[name]; + m_actors.Remove(name); + beingRemoved.Dispose(); + ret = true; + } } return ret; } public void Clear() { - Release(); - m_actors.Clear(); + lock (m_actors) + { + Release(); + m_actors.Clear(); + } } public void Dispose() { @@ -69,15 +81,22 @@ public class BSActorCollection { return m_actors.ContainsKey(name); } + public bool TryGetActor(string actorName, out BSActor theActor) + { + return m_actors.TryGetValue(actorName, out theActor); + } public void ForEachActor(Action act) { - foreach (KeyValuePair kvp in m_actors) - act(kvp.Value); + lock (m_actors) + { + foreach (KeyValuePair kvp in m_actors) + act(kvp.Value); + } } public void Enable(bool enabl) { - ForEachActor(a => a.Enable(enabl)); + ForEachActor(a => a.SetEnabled(enabl)); } public void Release() { @@ -106,7 +125,7 @@ public abstract class BSActor { protected BSScene m_physicsScene { get; private set; } protected BSPhysObject m_controllingPrim { get; private set; } - protected bool Enabled { get; set; } + public virtual bool Enabled { get; set; } public string ActorName { get; private set; } public BSActor(BSScene physicsScene, BSPhysObject pObj, string actorName) @@ -122,8 +141,10 @@ public abstract class BSActor { get { return Enabled; } } - // Turn the actor on an off. - public virtual void Enable(bool setEnabled) + + // Turn the actor on an off. Only used by ActorCollection to set all enabled/disabled. + // Anyone else should assign true/false to 'Enabled'. + public void SetEnabled(bool setEnabled) { Enabled = setEnabled; } -- cgit v1.1 From e5582939fd8d78b61c6f1eeda6de45d94f4b4926 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 28 Apr 2013 14:44:21 -0700 Subject: BulletSim: massive refactor of shape classes. Removed shape specific code from BSShapeCollection. Using BSShape* classes to hold references to shape. Simplified shape dependency callbacks. Remove 'PreferredShape' methods and have each class specify shape type. Disable compound shape linkset for a later commit that will simplify linkset implementation. --- OpenSim/Region/Physics/BulletSPlugin/BSActors.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSActors.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs index 12a8817..5e3f1c4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs @@ -106,9 +106,9 @@ public class BSActorCollection { ForEachActor(a => a.Refresh()); } - public void RemoveBodyDependencies() + public void RemoveDependencies() { - ForEachActor(a => a.RemoveBodyDependencies()); + ForEachActor(a => a.RemoveDependencies()); } } @@ -154,7 +154,7 @@ public abstract class BSActor public abstract void Refresh(); // The object's physical representation is being rebuilt so pick up any physical dependencies (constraints, ...). // Register a prestep action to restore physical requirements before the next simulation step. - public abstract void RemoveBodyDependencies(); + public abstract void RemoveDependencies(); } } -- cgit v1.1 From 92ee288d666963aae2a058cc964be009a504f084 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 29 Apr 2013 07:54:50 -0700 Subject: BulletSim: remove trailing white space to make git happier. No functional changes. --- OpenSim/Region/Physics/BulletSPlugin/BSActors.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSActors.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs index 5e3f1c4..fff63e4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs @@ -117,7 +117,7 @@ public class BSActorCollection /// Each physical object can have 'actors' who are pushing the object around. /// This can be used for hover, locking axis, making vehicles, etc. /// Each physical object can have multiple actors acting on it. -/// +/// /// An actor usually registers itself with physics scene events (pre-step action) /// and modifies the parameters on the host physical object. /// -- cgit v1.1 From b44f0e1a00eba7f76401692322e48a3b23a81164 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 16 Jul 2013 10:02:14 -0700 Subject: BulletSim: Add logic to linksets to change physical properties for whole linkset. Override physical property setting for BSLinksetCompound as there are not children to the compound spape. --- OpenSim/Region/Physics/BulletSPlugin/BSActors.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSActors.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs index fff63e4..e0ccc50 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs @@ -69,7 +69,7 @@ public class BSActorCollection { lock (m_actors) { - Release(); + ForEachActor(a => a.Dispose()); m_actors.Clear(); } } @@ -98,10 +98,6 @@ public class BSActorCollection { ForEachActor(a => a.SetEnabled(enabl)); } - public void Release() - { - ForEachActor(a => a.Dispose()); - } public void Refresh() { ForEachActor(a => a.Refresh()); -- cgit v1.1 From 84d0699761b8da546f9faef084240d7b15f16321 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 22 Jul 2013 12:07:42 -0700 Subject: Revert "BulletSim: Add logic to linksets to change physical properties for" The changes don't seem to be ready for prime time. This reverts commit b44f0e1a00eba7f76401692322e48a3b23a81164. --- OpenSim/Region/Physics/BulletSPlugin/BSActors.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSActors.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs index e0ccc50..fff63e4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs @@ -69,7 +69,7 @@ public class BSActorCollection { lock (m_actors) { - ForEachActor(a => a.Dispose()); + Release(); m_actors.Clear(); } } @@ -98,6 +98,10 @@ public class BSActorCollection { ForEachActor(a => a.SetEnabled(enabl)); } + public void Release() + { + ForEachActor(a => a.Dispose()); + } public void Refresh() { ForEachActor(a => a.Refresh()); -- cgit v1.1 From f499b328c44ef29d92aa2ef8102aad6ff5cbe336 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 23 Jul 2013 08:14:20 -0700 Subject: Revert "Revert "BulletSim: Add logic to linksets to change physical properties for"" Found that the vehicle movement problem was not caused by these physics changes. This reverts commit 84d0699761b8da546f9faef084240d7b15f16321. --- OpenSim/Region/Physics/BulletSPlugin/BSActors.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSActors.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs index fff63e4..e0ccc50 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs @@ -69,7 +69,7 @@ public class BSActorCollection { lock (m_actors) { - Release(); + ForEachActor(a => a.Dispose()); m_actors.Clear(); } } @@ -98,10 +98,6 @@ public class BSActorCollection { ForEachActor(a => a.SetEnabled(enabl)); } - public void Release() - { - ForEachActor(a => a.Dispose()); - } public void Refresh() { ForEachActor(a => a.Refresh()); -- cgit v1.1