aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs')
-rw-r--r--OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs50
1 files changed, 36 insertions, 14 deletions
diff --git a/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs
index 043c2f1..10e92fe 100644
--- a/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs
@@ -98,7 +98,7 @@ namespace OpenSim.Physics.PhysXPlugin
98 { 98 {
99 private List<PhysXCharacter> _characters = new List<PhysXCharacter>(); 99 private List<PhysXCharacter> _characters = new List<PhysXCharacter>();
100 private List<PhysXPrim> _prims = new List<PhysXPrim>(); 100 private List<PhysXPrim> _prims = new List<PhysXPrim>();
101 private float[] _heightMap; 101 private float[] _heightMap = null;
102 private NxPhysicsSDK mySdk; 102 private NxPhysicsSDK mySdk;
103 private NxScene scene; 103 private NxScene scene;
104 104
@@ -138,18 +138,25 @@ namespace OpenSim.Physics.PhysXPlugin
138 } 138 }
139 public override void Simulate(float timeStep) 139 public override void Simulate(float timeStep)
140 { 140 {
141 foreach (PhysXCharacter actor in _characters) 141 try
142 { 142 {
143 actor.Move(timeStep); 143 foreach (PhysXCharacter actor in _characters)
144 } 144 {
145 scene.Simulate(timeStep); 145 actor.Move(timeStep);
146 scene.FetchResults(); 146 }
147 scene.UpdateControllers(); 147 scene.Simulate(timeStep);
148 148 scene.FetchResults();
149 foreach (PhysXCharacter actor in _characters) 149 scene.UpdateControllers();
150 { 150
151 actor.UpdatePosition(); 151 foreach (PhysXCharacter actor in _characters)
152 } 152 {
153 actor.UpdatePosition();
154 }
155 }
156 catch (Exception e)
157 {
158 Console.WriteLine(e.Message);
159 }
153 160
154 } 161 }
155 162
@@ -168,10 +175,20 @@ namespace OpenSim.Physics.PhysXPlugin
168 175
169 public override void SetTerrain(float[] heightMap) 176 public override void SetTerrain(float[] heightMap)
170 { 177 {
178 if (this._heightMap != null)
179 {
180 Console.WriteLine("PhysX - deleting old terrain");
181 this.scene.DeleteTerrain();
182 }
171 this._heightMap = heightMap; 183 this._heightMap = heightMap;
172 this.scene.AddTerrain(heightMap); 184 this.scene.AddTerrain(heightMap);
173 } 185 }
174 } 186
187 public override void DeleteTerrain()
188 {
189 this.scene.DeleteTerrain();
190 }
191 }
175 192
176 public class PhysXCharacter : PhysicsActor 193 public class PhysXCharacter : PhysicsActor
177 { 194 {
@@ -211,6 +228,11 @@ namespace OpenSim.Physics.PhysXPlugin
211 set 228 set
212 { 229 {
213 _position = value; 230 _position = value;
231 Vec3 ps = new Vec3();
232 ps.X = value.X;
233 ps.Y = value.Y;
234 ps.Z = value.Z;
235 this._character.Position = ps;
214 } 236 }
215 } 237 }
216 238