aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/world/World.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/world/World.cs')
-rw-r--r--src/world/World.cs30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/world/World.cs b/src/world/World.cs
index ebbd61e..920220f 100644
--- a/src/world/World.cs
+++ b/src/world/World.cs
@@ -3,6 +3,7 @@ using libsecondlife;
3using libsecondlife.Packets; 3using libsecondlife.Packets;
4using System.Collections.Generic; 4using System.Collections.Generic;
5using System.Text; 5using System.Text;
6using PhysicsManager;
6 7
7namespace OpenSim.world 8namespace OpenSim.world
8{ 9{
@@ -13,6 +14,8 @@ namespace OpenSim.world
13 public ScriptEngine Scripts; 14 public ScriptEngine Scripts;
14 public TerrainDecode terrainengine = new TerrainDecode(); 15 public TerrainDecode terrainengine = new TerrainDecode();
15 public uint _localNumber=0; 16 public uint _localNumber=0;
17 private PhysicsScene phyScene;
18 private float timeStep= 0.1f;
16 19
17 private Random Rand = new Random(); 20 private Random Rand = new Random();
18 21
@@ -32,9 +35,30 @@ namespace OpenSim.world
32 // Initialise this only after the world has loaded 35 // Initialise this only after the world has loaded
33 Scripts = new ScriptEngine(this); 36 Scripts = new ScriptEngine(this);
34 } 37 }
35 38
39 public PhysicsScene PhysScene
40 {
41 set
42 {
43 this.phyScene = value;
44 }
45 }
46
36 public void Update() 47 public void Update()
37 { 48 {
49 if(this.phyScene.IsThreaded)
50 {
51 this.phyScene.GetResults();
52
53 }
54
55 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
56 {
57 Entities[UUID].addFroces();
58 }
59
60 this.phyScene.Simulate(timeStep);
61
38 foreach (libsecondlife.LLUUID UUID in Entities.Keys) 62 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
39 { 63 {
40 Entities[UUID].update(); 64 Entities[UUID].update();
@@ -55,7 +79,9 @@ namespace OpenSim.world
55 this.Entities.Add(AgentClient.AgentID, NewAvatar); 79 this.Entities.Add(AgentClient.AgentID, NewAvatar);
56 Console.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); 80 Console.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
57 NewAvatar.SendRegionHandshake(this); 81 NewAvatar.SendRegionHandshake(this);
58 this.Update(); // will work for now, but needs to be optimised so we don't update everything in the sim for each new user 82
83 NewAvatar.PhysActor = this.phyScene.AddAvatar(new PhysicsVector(NewAvatar.position.x, NewAvatar.position.y, NewAvatar.position.z));
84 //this.Update(); // will work for now, but needs to be optimised so we don't update everything in the sim for each new user
59 } 85 }
60 86
61 public bool Backup() { 87 public bool Backup() {