diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim.RegionServer/world/Entity.cs | 62 |
1 files changed, 52 insertions, 10 deletions
diff --git a/OpenSim.RegionServer/world/Entity.cs b/OpenSim.RegionServer/world/Entity.cs index 567c0b7..424d395 100644 --- a/OpenSim.RegionServer/world/Entity.cs +++ b/OpenSim.RegionServer/world/Entity.cs | |||
@@ -2,31 +2,78 @@ using System; | |||
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using Axiom.MathLib; | 4 | using Axiom.MathLib; |
5 | using OpenSim.Physics.Manager; | ||
5 | using OpenSim.types; | 6 | using OpenSim.types; |
6 | using libsecondlife; | 7 | using libsecondlife; |
8 | using OpenSim.RegionServer.world.scripting; | ||
7 | 9 | ||
8 | namespace OpenSim.world | 10 | namespace OpenSim.world |
9 | { | 11 | { |
10 | public class Entity | 12 | public abstract class Entity : IScriptReadonlyEntity |
11 | { | 13 | { |
12 | public libsecondlife.LLUUID uuid; | 14 | public libsecondlife.LLUUID uuid; |
13 | public uint localid; | 15 | public uint localid; |
14 | public LLVector3 position; | ||
15 | public LLVector3 velocity; | 16 | public LLVector3 velocity; |
16 | public Quaternion rotation; | 17 | public Quaternion rotation; |
17 | protected string name; | ||
18 | protected List<Entity> children; | 18 | protected List<Entity> children; |
19 | 19 | ||
20 | protected string m_name; | ||
21 | public virtual string Name | ||
22 | { | ||
23 | get { return m_name; } | ||
24 | } | ||
25 | |||
26 | private LLVector3 m_pos; | ||
27 | protected PhysicsActor _physActor; | ||
28 | protected World m_world; | ||
29 | |||
30 | public LLVector3 Pos | ||
31 | { | ||
32 | get | ||
33 | { | ||
34 | if (this._physActor != null) | ||
35 | { | ||
36 | m_pos.X = _physActor.Position.X; | ||
37 | m_pos.Y = _physActor.Position.Y; | ||
38 | m_pos.Z = _physActor.Position.Z; | ||
39 | } | ||
40 | |||
41 | return m_pos; | ||
42 | } | ||
43 | set | ||
44 | { | ||
45 | if (this._physActor != null) | ||
46 | { | ||
47 | try | ||
48 | { | ||
49 | lock (this.m_world.LockPhysicsEngine) | ||
50 | { | ||
51 | |||
52 | this._physActor.Position = new PhysicsVector(value.X, value.Y, value.Z); | ||
53 | } | ||
54 | } | ||
55 | catch (Exception e) | ||
56 | { | ||
57 | Console.WriteLine(e.Message); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | m_pos = value; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | |||
20 | public Entity() | 66 | public Entity() |
21 | { | 67 | { |
22 | uuid = new libsecondlife.LLUUID(); | 68 | uuid = new libsecondlife.LLUUID(); |
23 | localid = 0; | 69 | localid = 0; |
24 | position = new LLVector3(); | 70 | m_pos = new LLVector3(); |
25 | velocity = new LLVector3(); | 71 | velocity = new LLVector3(); |
26 | rotation = new Quaternion(); | 72 | rotation = new Quaternion(); |
27 | name = "(basic entity)"; | 73 | m_name = "(basic entity)"; |
28 | children = new List<Entity>(); | 74 | children = new List<Entity>(); |
29 | } | 75 | } |
76 | |||
30 | public virtual void addForces() | 77 | public virtual void addForces() |
31 | { | 78 | { |
32 | foreach (Entity child in children) | 79 | foreach (Entity child in children) |
@@ -42,11 +89,6 @@ namespace OpenSim.world | |||
42 | } | 89 | } |
43 | } | 90 | } |
44 | 91 | ||
45 | public virtual string getName() | ||
46 | { | ||
47 | return name; | ||
48 | } | ||
49 | |||
50 | public virtual Mesh getMesh() | 92 | public virtual Mesh getMesh() |
51 | { | 93 | { |
52 | Mesh mesh = new Mesh(); | 94 | Mesh mesh = new Mesh(); |