From 98d81485e724b26d9ad35b9b7cd24c98808b9a81 Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 28 Mar 2007 13:08:27 +0000 Subject: RIP OpenSimRoot. (removed) Merged most of the bug fixes etc in from LLdemo branch. Added the textures from that branch. --- OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs | 50 +++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 14 deletions(-) (limited to 'OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs') 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 { private List _characters = new List(); private List _prims = new List(); - private float[] _heightMap; + private float[] _heightMap = null; private NxPhysicsSDK mySdk; private NxScene scene; @@ -138,18 +138,25 @@ namespace OpenSim.Physics.PhysXPlugin } public override void Simulate(float timeStep) { - foreach (PhysXCharacter actor in _characters) - { - actor.Move(timeStep); - } - scene.Simulate(timeStep); - scene.FetchResults(); - scene.UpdateControllers(); - - foreach (PhysXCharacter actor in _characters) - { - actor.UpdatePosition(); - } + try + { + foreach (PhysXCharacter actor in _characters) + { + actor.Move(timeStep); + } + scene.Simulate(timeStep); + scene.FetchResults(); + scene.UpdateControllers(); + + foreach (PhysXCharacter actor in _characters) + { + actor.UpdatePosition(); + } + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } } @@ -168,10 +175,20 @@ namespace OpenSim.Physics.PhysXPlugin public override void SetTerrain(float[] heightMap) { + if (this._heightMap != null) + { + Console.WriteLine("PhysX - deleting old terrain"); + this.scene.DeleteTerrain(); + } this._heightMap = heightMap; this.scene.AddTerrain(heightMap); } - } + + public override void DeleteTerrain() + { + this.scene.DeleteTerrain(); + } + } public class PhysXCharacter : PhysicsActor { @@ -211,6 +228,11 @@ namespace OpenSim.Physics.PhysXPlugin set { _position = value; + Vec3 ps = new Vec3(); + ps.X = value.X; + ps.Y = value.Y; + ps.Z = value.Z; + this._character.Position = ps; } } -- cgit v1.1