diff options
Diffstat (limited to 'OpenSim/Region/Examples/SimpleApp/ComplexObject.cs')
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/ComplexObject.cs | 65 |
1 files changed, 37 insertions, 28 deletions
diff --git a/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs index f5a080f..bfd9d06 100644 --- a/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs +++ b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs | |||
@@ -26,60 +26,69 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenSim.Region.Environment.Scenes; | ||
33 | using Axiom.Math; | ||
34 | using libsecondlife; | 29 | using libsecondlife; |
35 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Interfaces; | 31 | using OpenSim.Region.Environment.Scenes; |
37 | 32 | ||
38 | namespace SimpleApp | 33 | namespace SimpleApp |
39 | { | 34 | { |
40 | public class ComplexObject : SceneObjectGroup | 35 | public class ComplexObject : SceneObjectGroup |
41 | { | 36 | { |
42 | private LLQuaternion m_rotationDirection; | 37 | private LLQuaternion m_rotationDirection; |
43 | 38 | ||
44 | private class RotatingWheel : SceneObjectPart | 39 | private class RotatingWheel : SceneObjectPart |
45 | { | 40 | { |
46 | private LLQuaternion m_rotationDirection; | 41 | private LLQuaternion m_rotationDirection; |
47 | 42 | ||
48 | public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, LLVector3 groupPosition, LLVector3 offsetPosition, LLQuaternion rotationDirection) | 43 | public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, |
49 | : base(regionHandle, parent, ownerID, localID, new CylinderShape( 0.5f, 0.2f ), groupPosition, offsetPosition ) | 44 | LLVector3 groupPosition, LLVector3 offsetPosition, LLQuaternion rotationDirection) |
45 | : base( | ||
46 | regionHandle, parent, ownerID, localID, new CylinderShape(0.5f, 0.2f), groupPosition, offsetPosition | ||
47 | ) | ||
50 | { | 48 | { |
51 | m_rotationDirection = rotationDirection; | 49 | m_rotationDirection = rotationDirection; |
52 | } | 50 | } |
53 | 51 | ||
54 | public override void UpdateMovement() | 52 | public override void UpdateMovement() |
55 | { | 53 | { |
56 | UpdateRotation(RotationOffset * m_rotationDirection); | 54 | UpdateRotation(RotationOffset*m_rotationDirection); |
57 | } | 55 | } |
58 | } | 56 | } |
59 | 57 | ||
60 | public override void UpdateMovement() | 58 | public override void UpdateMovement() |
61 | { | 59 | { |
62 | UpdateGroupRotation(GroupRotation * m_rotationDirection); | 60 | UpdateGroupRotation(GroupRotation*m_rotationDirection); |
63 | 61 | ||
64 | base.UpdateMovement(); | 62 | base.UpdateMovement(); |
65 | } | 63 | } |
66 | 64 | ||
67 | 65 | ||
68 | 66 | public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos) | |
69 | public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos ) | 67 | : base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default) |
70 | : base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default ) | ||
71 | { | 68 | { |
72 | m_rotationDirection = new LLQuaternion(0.05f, 0.1f, 0.15f); | 69 | m_rotationDirection = new LLQuaternion(0.05f, 0.1f, 0.15f); |
73 | 70 | ||
74 | AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, 0.75f), new LLQuaternion(0.05f,0,0))); | 71 | AddPart( |
75 | AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, -0.75f), new LLQuaternion(-0.05f,0,0))); | 72 | new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, 0.75f), |
73 | new LLQuaternion(0.05f, 0, 0))); | ||
74 | AddPart( | ||
75 | new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, -0.75f), | ||
76 | new LLQuaternion(-0.05f, 0, 0))); | ||
77 | |||
78 | AddPart( | ||
79 | new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0.75f, 0), | ||
80 | new LLQuaternion(0.5f, 0, 0.05f))); | ||
81 | AddPart( | ||
82 | new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, -0.75f, 0), | ||
83 | new LLQuaternion(-0.5f, 0, -0.05f))); | ||
76 | 84 | ||
77 | AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0.75f,0), new LLQuaternion(0.5f, 0, 0.05f))); | 85 | AddPart( |
78 | AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, -0.75f,0), new LLQuaternion(-0.5f, 0, -0.05f))); | 86 | new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0.75f, 0, 0), |
87 | new LLQuaternion(0, 0.5f, 0.05f))); | ||
88 | AddPart( | ||
89 | new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(-0.75f, 0, 0), | ||
90 | new LLQuaternion(0, -0.5f, -0.05f))); | ||
79 | 91 | ||
80 | AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0.75f, 0, 0), new LLQuaternion(0, 0.5f, 0.05f))); | ||
81 | AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(-0.75f, 0, 0), new LLQuaternion(0, -0.5f, -0.05f))); | ||
82 | |||
83 | UpdateParentIDs(); | 92 | UpdateParentIDs(); |
84 | } | 93 | } |
85 | 94 | ||
@@ -88,12 +97,12 @@ namespace SimpleApp | |||
88 | m_parts.Remove(part.UUID); | 97 | m_parts.Remove(part.UUID); |
89 | remoteClient.SendKillObject(m_regionHandle, part.LocalID); | 98 | remoteClient.SendKillObject(m_regionHandle, part.LocalID); |
90 | remoteClient.AddMoney(1); | 99 | remoteClient.AddMoney(1); |
91 | remoteClient.SendChatMessage("Poof!", 1, this.AbsolutePosition, "Party Party", LLUUID.Zero); | 100 | remoteClient.SendChatMessage("Poof!", 1, AbsolutePosition, "Party Party", LLUUID.Zero); |
92 | } | 101 | } |
93 | 102 | ||
94 | public override void OnGrabGroup( LLVector3 offsetPos, IClientAPI remoteClient) | 103 | public override void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient) |
95 | { | 104 | { |
96 | if( m_parts.Count == 1 ) | 105 | if (m_parts.Count == 1) |
97 | { | 106 | { |
98 | m_parts.Remove(m_rootPart.UUID); | 107 | m_parts.Remove(m_rootPart.UUID); |
99 | m_scene.RemoveEntity(this); | 108 | m_scene.RemoveEntity(this); |
@@ -103,4 +112,4 @@ namespace SimpleApp | |||
103 | } | 112 | } |
104 | } | 113 | } |
105 | } | 114 | } |
106 | } | 115 | } \ No newline at end of file |