From f0176ce13f3a992db791234139297b456394efe8 Mon Sep 17 00:00:00 2001 From: Jon Cundill Date: Sat, 9 Jul 2011 13:27:58 +0100 Subject: [PATCH] added basic ability to set the boid prim - no error checking yet --- Flocking/FlockingModule.cs | 8 +++++++- Flocking/FlockingView.cs | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Flocking/FlockingModule.cs b/Flocking/FlockingModule.cs index 5aebc04..e1f67f9 100644 --- a/Flocking/FlockingModule.cs +++ b/Flocking/FlockingModule.cs @@ -89,6 +89,7 @@ namespace Flocking // init module m_model = new FlockingModel (); m_view = new FlockingView (m_scene); + m_view.BoidPrim = m_boidPrim; } } @@ -266,7 +267,12 @@ namespace Flocking public void HandleSetPrimCmd (string module, string[] args) { if (ShouldHandleCmd ()) { - m_log.Info ("set prim not implemented yet"); + //m_log.Info ("set prim not implemented yet"); + string primName = args[1]; + lock(m_sync) { + m_view.BoidPrim = primName; + m_view.Clear(); + } } } diff --git a/Flocking/FlockingView.cs b/Flocking/FlockingView.cs index 5777050..f26744c 100644 --- a/Flocking/FlockingView.cs +++ b/Flocking/FlockingView.cs @@ -38,6 +38,7 @@ namespace Flocking private Scene m_scene; private UUID m_owner; + private String m_boidPrim; private Dictionary m_sogMap = new Dictionary (); @@ -50,6 +51,10 @@ namespace Flocking { m_owner = owner; } + + public String BoidPrim { + set{ m_boidPrim = value;} + } public void Clear () { @@ -75,7 +80,7 @@ namespace Flocking SceneObjectGroup sog; if (existing == null) { - SceneObjectGroup group = findByName ("boidPrim"); + SceneObjectGroup group = findByName (m_boidPrim); sog = CopyPrim (group, boid.Id); m_sogMap [boid.Id] = sog; m_scene.AddNewSceneObject (sog, false); @@ -137,7 +142,7 @@ namespace Flocking private SceneObjectGroup MakeDefaultPrim (string name) { PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere (); - shape.Scale = new Vector3 (0.5f, 0.5f, 2.5f); + shape.Scale = new Vector3 (0.5f, 0.5f, 0.5f); SceneObjectGroup prim = new SceneObjectGroup (m_owner, new Vector3 (128f, 128f, 25f), shape); prim.Name = name;