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. --- .../BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 5 +++ OpenSim.Physics/Manager/PhysicsScene.cs | 9 ++++ OpenSim.Physics/OdePlugin/OdePlugin.cs | 5 +++ OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs | 50 ++++++++++++++++------ 4 files changed, 55 insertions(+), 14 deletions(-) (limited to 'OpenSim.Physics') diff --git a/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index deff803..62b6ffc 100644 --- a/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs @@ -149,6 +149,11 @@ namespace OpenSim.Physics.BasicPhysicsPlugin { this._heightMap = heightMap; } + + public override void DeleteTerrain() + { + + } } public class BasicActor : PhysicsActor diff --git a/OpenSim.Physics/Manager/PhysicsScene.cs b/OpenSim.Physics/Manager/PhysicsScene.cs index 632b9cd..0b3dfd2 100644 --- a/OpenSim.Physics/Manager/PhysicsScene.cs +++ b/OpenSim.Physics/Manager/PhysicsScene.cs @@ -50,6 +50,8 @@ namespace OpenSim.Physics.Manager public abstract void GetResults(); public abstract void SetTerrain(float[] heightMap); + + public abstract void DeleteTerrain(); public abstract bool IsThreaded { @@ -76,6 +78,8 @@ namespace OpenSim.Physics.Manager public override void Simulate(float timeStep) { m_workIndicator = (m_workIndicator + 1) % 10; + + //OpenSim.Framework.Console.MainConsole.Instance.SetStatus(m_workIndicator.ToString()); } public override void GetResults() @@ -88,6 +92,11 @@ namespace OpenSim.Physics.Manager OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length); } + public override void DeleteTerrain() + { + + } + public override bool IsThreaded { get { return false; } diff --git a/OpenSim.Physics/OdePlugin/OdePlugin.cs b/OpenSim.Physics/OdePlugin/OdePlugin.cs index 8e34a6b..7b0d64a 100644 --- a/OpenSim.Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim.Physics/OdePlugin/OdePlugin.cs @@ -170,6 +170,11 @@ namespace OpenSim.Physics.OdePlugin d.GeomHeightfieldDataBuildDouble(HeightmapData,_heightmap,1,256,256,256,256,1.0f,0.0f,2.0f,0); LandGeom=d.CreateHeightfield(space, HeightmapData, 0); } + + public override void DeleteTerrain() + { + + } } public class OdeCharacter : PhysicsActor 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