From c47bca94d23420b164e5f32aa5c781009496e0d3 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Wed, 15 Aug 2007 16:57:47 +0000 Subject: * Exploring Group/Part from an app perspective. --- OpenSim/Region/Examples/SimpleApp/ComplexObject.cs | 46 ++++++++++++++++++++++ .../Region/Examples/SimpleApp/CpuCounterObject.cs | 4 +- OpenSim/Region/Examples/SimpleApp/Program.cs | 13 +++--- 3 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 OpenSim/Region/Examples/SimpleApp/ComplexObject.cs (limited to 'OpenSim/Region/Examples') diff --git a/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs new file mode 100644 index 0000000..25960b7 --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Region.Environment.Scenes; +using Axiom.Math; +using libsecondlife; +using OpenSim.Framework.Types; + +namespace SimpleApp +{ + public class ComplexObject : SceneObjectGroup + { + private LLQuaternion m_rotationDirection; + + private class RotatingWheel : SceneObjectPart + { + private static LLQuaternion m_rotationDirection = new LLQuaternion(0.05f, 0, 0); + + public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, LLVector3 groupPosition, LLVector3 offsetPosition) + : base(regionHandle, parent, ownerID, localID, BoxShape.Default, groupPosition, offsetPosition ) + { + } + + public override void UpdateMovement() + { + UpdateRotation(RotationOffset * m_rotationDirection); + } + } + + public override void UpdateMovement() + { + UpdateGroupRotation(Rotation * m_rotationDirection); + + base.UpdateMovement(); + } + + public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos ) + : base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default ) + { + m_rotationDirection = new LLQuaternion(0.05f, 0.1f, 0.15f); + + AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, 1f))); + AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, -1f))); + } + } +} diff --git a/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs b/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs index 108fa98..4ce59cb 100644 --- a/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs +++ b/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs @@ -13,8 +13,8 @@ namespace SimpleApp { private PerformanceCounter m_counter; - public CpuCounterObject(Scene world, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) - : base(world, regionHandle, ownerID, localID, pos, shape ) + public CpuCounterObject(Scene world, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos ) + : base(world, regionHandle, ownerID, localID, pos, BoxShape.Default ) { String objectName = "Processor"; String counterName = "% Processor Time"; diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 0763b83..59d73ba 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -65,14 +65,15 @@ namespace SimpleApp udpServer.ServerListener(); - PrimitiveBaseShape shape = BoxShape.Default; - shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); - LLVector3 pos = new LLVector3(138, 129, 27); + LLVector3 pos = new LLVector3(110, 129, 27); - SceneObjectGroup sceneObject = new CpuCounterObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos, shape); - scene.AddEntity(sceneObject); + SceneObjectGroup sceneObject = new CpuCounterObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos + new LLVector3( 1f, 1f, 1f )); + scene.AddEntity(sceneObject); - MyNpcCharacter m_character = new MyNpcCharacter( scene.EventManager ); + ComplexObject complexObject = new ComplexObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos + new LLVector3( 2f, 2f, 2f )); + scene.AddEntity(complexObject); + + MyNpcCharacter m_character = new MyNpcCharacter(scene.EventManager); scene.AddNewClient(m_character, false); DirectoryInfo dirInfo = new DirectoryInfo( "." ); -- cgit v1.1