From 5c7ffdde0b9642a42e8f5987e06eb01220ff7776 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Wed, 11 Jul 2007 08:02:47 +0000 Subject: * Wiping trunk in prep for Sugilite --- .../BasicPhysicsPlugin/AssemblyInfo.cs | 58 --- .../BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 278 ------------- .../OpenSim.Physics.BasicPhysicsPlugin.csproj | 93 ----- .../OpenSim.Physics.BasicPhysicsPlugin.dll.build | 42 -- OpenSim/OpenSim.Physics/Manager/AssemblyInfo.cs | 58 --- .../Manager/OpenSim.Physics.Manager.csproj | 112 ----- .../Manager/OpenSim.Physics.Manager.dll.build | 47 --- OpenSim/OpenSim.Physics/Manager/PhysicsActor.cs | 162 -------- OpenSim/OpenSim.Physics/Manager/PhysicsManager.cs | 117 ------ OpenSim/OpenSim.Physics/Manager/PhysicsScene.cs | 114 ----- OpenSim/OpenSim.Physics/Manager/PhysicsVector.cs | 55 --- OpenSim/OpenSim.Physics/OdePlugin/AssemblyInfo.cs | 58 --- OpenSim/OpenSim.Physics/OdePlugin/OdePlugin.cs | 457 --------------------- .../OdePlugin/OpenSim.Physics.OdePlugin.csproj | 97 ----- .../OdePlugin/OpenSim.Physics.OdePlugin.dll.build | 43 -- .../OpenSim.Physics/PhysXPlugin/AssemblyInfo.cs | 58 --- .../PhysXPlugin/OpenSim.Physics.PhysXPlugin.csproj | 97 ----- .../OpenSim.Physics.PhysXPlugin.dll.build | 43 -- OpenSim/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs | 424 ------------------- 19 files changed, 2413 deletions(-) delete mode 100644 OpenSim/OpenSim.Physics/BasicPhysicsPlugin/AssemblyInfo.cs delete mode 100644 OpenSim/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs delete mode 100644 OpenSim/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj delete mode 100644 OpenSim/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build delete mode 100644 OpenSim/OpenSim.Physics/Manager/AssemblyInfo.cs delete mode 100644 OpenSim/OpenSim.Physics/Manager/OpenSim.Physics.Manager.csproj delete mode 100644 OpenSim/OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build delete mode 100644 OpenSim/OpenSim.Physics/Manager/PhysicsActor.cs delete mode 100644 OpenSim/OpenSim.Physics/Manager/PhysicsManager.cs delete mode 100644 OpenSim/OpenSim.Physics/Manager/PhysicsScene.cs delete mode 100644 OpenSim/OpenSim.Physics/Manager/PhysicsVector.cs delete mode 100644 OpenSim/OpenSim.Physics/OdePlugin/AssemblyInfo.cs delete mode 100644 OpenSim/OpenSim.Physics/OdePlugin/OdePlugin.cs delete mode 100644 OpenSim/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.csproj delete mode 100644 OpenSim/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build delete mode 100644 OpenSim/OpenSim.Physics/PhysXPlugin/AssemblyInfo.cs delete mode 100644 OpenSim/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.csproj delete mode 100644 OpenSim/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build delete mode 100644 OpenSim/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs (limited to 'OpenSim/OpenSim.Physics') diff --git a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/AssemblyInfo.cs deleted file mode 100644 index 177c49d..0000000 --- a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("PhysXplugin")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("PhysXplugin")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. -[assembly: ComVisible(false)] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly: AssemblyVersion("1.0.*")] diff --git a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs deleted file mode 100644 index 3d8c9aa..0000000 --- a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ /dev/null @@ -1,278 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using OpenSim.Physics.Manager; - -namespace OpenSim.Physics.BasicPhysicsPlugin -{ - /// - /// Will be the PhysX plugin but for now will be a very basic physics engine - /// - public class BasicPhysicsPlugin : IPhysicsPlugin - { - private BasicScene _mScene; - - public BasicPhysicsPlugin() - { - - } - - public bool Init() - { - return true; - } - - public PhysicsScene GetScene() - { - if(_mScene == null) - { - _mScene = new BasicScene(); - } - return(_mScene); - } - - public string GetName() - { - return("basicphysics"); - } - - public void Dispose() - { - - } - } - - public class BasicScene :PhysicsScene - { - private List _actors = new List(); - private float[] _heightMap; - - public BasicScene() - { - - } - - public override PhysicsActor AddAvatar(PhysicsVector position) - { - BasicActor act = new BasicActor(); - act.Position = position; - _actors.Add(act); - return act; - } - - public override void RemoveAvatar(PhysicsActor actor) - { - BasicActor act = (BasicActor)actor; - if(_actors.Contains(act)) - { - _actors.Remove(act); - } - - } - - public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) - { - return null; - } - - public override void Simulate(float timeStep) - { - foreach (BasicActor actor in _actors) - { - actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep); - actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep); - actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); - /*if(actor.Flying) - { - actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); - } - else - { - actor.Position.Z = actor.Position.Z + ((-9.8f + actor.Velocity.Z) * timeStep); - } - if(actor.Position.Z < (_heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1)) - {*/ - if ((actor.Position.Y > 0 && actor.Position.Y < 256) && (actor.Position.X > 0 && actor.Position.X < 256)) - { - actor.Position.Z = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1; - } - //} - - - - // This code needs sorting out - border crossings etc -/* if(actor.Position.X<0) - { - ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); - actor.Position.X = 0; - actor.Velocity.X = 0; - } - if(actor.Position.Y < 0) - { - ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); - actor.Position.Y = 0; - actor.Velocity.Y = 0; - } - if(actor.Position.X > 255) - { - ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); - actor.Position.X = 255; - actor.Velocity.X = 0; - } - if(actor.Position.Y > 255) - { - ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); - actor.Position.Y = 255; - actor.Velocity.X = 0; - }*/ - } - } - - public override void GetResults() - { - - } - - public override bool IsThreaded - { - get - { - return(false); // for now we won't be multithreaded - } - } - - public override void SetTerrain(float[] heightMap) - { - this._heightMap = heightMap; - } - - public override void DeleteTerrain() - { - - } - } - - public class BasicActor : PhysicsActor - { - private PhysicsVector _position; - private PhysicsVector _velocity; - private PhysicsVector _acceleration; - private bool flying; - public BasicActor() - { - _velocity = new PhysicsVector(); - _position = new PhysicsVector(); - _acceleration = new PhysicsVector(); - } - - public override bool Flying - { - get - { - return false; - } - set - { - flying= value; - } - } - - public override PhysicsVector Position - { - get - { - return _position; - } - set - { - _position = value; - } - } - - public override PhysicsVector Velocity - { - get - { - return _velocity; - } - set - { - _velocity = value; - } - } - - public override Axiom.MathLib.Quaternion Orientation - { - get - { - return Axiom.MathLib.Quaternion.Identity; - } - set - { - - } - } - - public override PhysicsVector Acceleration - { - get - { - return _acceleration; - } - - } - - public override bool Kinematic - { - get - { - return true; - } - set - { - - } - } - public void SetAcceleration (PhysicsVector accel) - { - this._acceleration = accel; - } - - public override void AddForce(PhysicsVector force) - { - - } - - public override void SetMomentum(PhysicsVector momentum) - { - - } - } - -} diff --git a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj b/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj deleted file mode 100644 index f88eb32..0000000 --- a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj +++ /dev/null @@ -1,93 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {4F874463-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Physics.BasicPhysicsPlugin - JScript - Grid - IE50 - false - Library - - OpenSim.Physics.BasicPhysicsPlugin - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\bin\Physics\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\bin\Physics\ - False - False - False - 4 - - - - - ..\..\..\bin\Axiom.MathLib.dll - False - - - System.dll - False - - - - - OpenSim.Physics.Manager - {8BE16150-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build b/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build deleted file mode 100644 index 00ca3f9..0000000 --- a/OpenSim/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/OpenSim.Physics/Manager/AssemblyInfo.cs b/OpenSim/OpenSim.Physics/Manager/AssemblyInfo.cs deleted file mode 100644 index 132f64a..0000000 --- a/OpenSim/OpenSim.Physics/Manager/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("PhysicsManager")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("PhysicsManager")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. -[assembly: ComVisible(false)] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly: AssemblyVersion("1.0.*")] diff --git a/OpenSim/OpenSim.Physics/Manager/OpenSim.Physics.Manager.csproj b/OpenSim/OpenSim.Physics/Manager/OpenSim.Physics.Manager.csproj deleted file mode 100644 index 347a649..0000000 --- a/OpenSim/OpenSim.Physics/Manager/OpenSim.Physics.Manager.csproj +++ /dev/null @@ -1,112 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {8BE16150-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Physics.Manager - JScript - Grid - IE50 - false - Library - - OpenSim.Physics.Manager - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\bin\Axiom.MathLib.dll - False - - - System.dll - False - - - System.Xml.dll - False - - - - - OpenSim.Framework - {8ACA2445-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Console - {A7CD0630-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build b/OpenSim/OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build deleted file mode 100644 index fc3e1e6..0000000 --- a/OpenSim/OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/OpenSim.Physics/Manager/PhysicsActor.cs b/OpenSim/OpenSim.Physics/Manager/PhysicsActor.cs deleted file mode 100644 index 9ff94c4..0000000 --- a/OpenSim/OpenSim.Physics/Manager/PhysicsActor.cs +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Physics.Manager -{ - public abstract class PhysicsActor - { - public static PhysicsActor Null - { - get - { - return new NullPhysicsActor(); - } - } - - public abstract PhysicsVector Position - { - get; - set; - } - - public abstract PhysicsVector Velocity - { - get; - set; - } - - public abstract PhysicsVector Acceleration - { - get; - } - - public abstract Axiom.MathLib.Quaternion Orientation - { - get; - set; - } - - public abstract bool Flying - { - get; - set; - } - - public abstract bool Kinematic - { - get; - set; - } - - public abstract void AddForce(PhysicsVector force); - - public abstract void SetMomentum(PhysicsVector momentum); - } - - public class NullPhysicsActor : PhysicsActor - { - public override PhysicsVector Position - { - get - { - return PhysicsVector.Zero; - } - set - { - return; - } - } - - public override PhysicsVector Velocity - { - get - { - return PhysicsVector.Zero; - } - set - { - return; - } - } - - public override Axiom.MathLib.Quaternion Orientation - { - get - { - return Axiom.MathLib.Quaternion.Identity; - } - set - { - - } - } - - public override PhysicsVector Acceleration - { - get { return PhysicsVector.Zero; } - } - - public override bool Flying - { - get - { - return false; - } - set - { - return; - } - } - - public override bool Kinematic - { - get - { - return true; - } - set - { - return; - } - } - - public override void AddForce(PhysicsVector force) - { - return; - } - - public override void SetMomentum(PhysicsVector momentum) - { - return; - } - } -} diff --git a/OpenSim/OpenSim.Physics/Manager/PhysicsManager.cs b/OpenSim/OpenSim.Physics/Manager/PhysicsManager.cs deleted file mode 100644 index f85c098..0000000 --- a/OpenSim/OpenSim.Physics/Manager/PhysicsManager.cs +++ /dev/null @@ -1,117 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Collections; -using System.IO; -using System.Reflection; -using Axiom.MathLib; -using OpenSim.Framework.Console; - -namespace OpenSim.Physics.Manager -{ - /// - /// Description of MyClass. - /// - public class PhysicsManager - { - private Dictionary _plugins=new Dictionary(); - - public PhysicsManager() - { - - } - - public PhysicsScene GetPhysicsScene(string engineName) - { - if (String.IsNullOrEmpty(engineName)) - { - return new NullPhysicsScene(); - } - - if(_plugins.ContainsKey(engineName)) - { - MainConsole.Instance.Notice("creating "+engineName); - return _plugins[engineName].GetScene(); - } - else - { - MainConsole.Instance.Warn("couldn't find physicsEngine: {0}",engineName); - throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}",engineName)); - } - } - - public void LoadPlugins() - { - string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory ,"Physics"); - string[] pluginFiles = Directory.GetFiles(path, "*.dll"); - - - for(int i= 0; i - /// ODE plugin - /// - public class OdePlugin : IPhysicsPlugin - { - private OdeScene _mScene; - - public OdePlugin() - { - - } - - public bool Init() - { - return true; - } - - public PhysicsScene GetScene() - { - if (_mScene == null) - { - _mScene = new OdeScene(); - } - return (_mScene); - } - - public string GetName() - { - return ("OpenDynamicsEngine"); - } - - public void Dispose() - { - - } - } - - public class OdeScene : PhysicsScene - { - static public IntPtr world; - static public IntPtr space; - static private IntPtr contactgroup; - static private IntPtr LandGeom; - //static private IntPtr Land; - private double[] _heightmap; - static private d.NearCallback nearCallback = near; - private List _characters = new List(); - private static d.ContactGeom[] contacts = new d.ContactGeom[30]; - private static d.Contact contact; - - public OdeScene() - { - contact.surface.mode |= d.ContactFlags.Approx1 | d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP; - contact.surface.mu = 10.0f; - contact.surface.bounce = 0.9f; - contact.surface.soft_erp = 0.005f; - contact.surface.soft_cfm = 0.00003f; - - world = d.WorldCreate(); - space = d.HashSpaceCreate(IntPtr.Zero); - contactgroup = d.JointGroupCreate(0); - d.WorldSetGravity(world, 0.0f, 0.0f, -10.0f); - d.WorldSetAutoDisableFlag(world, false); - d.WorldSetContactSurfaceLayer(world, 0.001f); - this._heightmap = new double[65536]; - } - - // This function blatantly ripped off from BoxStack.cs - static private void near(IntPtr space, IntPtr g1, IntPtr g2) - { - IntPtr b1 = d.GeomGetBody(g1); - IntPtr b2 = d.GeomGetBody(g2); - if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) - return; - - int count = d.Collide(g1, g2, 500, contacts, d.ContactGeom.SizeOf); - for (int i = 0; i < count; ++i) - { - contact.geom = contacts[i]; - IntPtr joint = d.JointCreateContact(world, contactgroup, ref contact); - d.JointAttach(joint, b1, b2); - } - - } - - public override PhysicsActor AddAvatar(PhysicsVector position) - { - PhysicsVector pos = new PhysicsVector(); - pos.X = position.X; - pos.Y = position.Y; - pos.Z = position.Z + 20; - OdeCharacter newAv = new OdeCharacter(this, pos); - this._characters.Add(newAv); - return newAv; - } - - public override void RemoveAvatar(PhysicsActor actor) - { - - } - - public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) - { - PhysicsVector pos = new PhysicsVector(); - pos.X = position.X; - pos.Y = position.Y; - pos.Z = position.Z; - PhysicsVector siz = new PhysicsVector(); - siz.X = size.X; - siz.Y = size.Y; - siz.Z = size.Z; - return new OdePrim(); - } - - public override void Simulate(float timeStep) - { - foreach (OdeCharacter actor in _characters) - { - actor.Move(timeStep); - } - d.SpaceCollide(space, IntPtr.Zero, nearCallback); - for (int i = 0; i < 50; i++) - { - d.WorldQuickStep(world, timeStep * 0.02f); - } - - d.JointGroupEmpty(contactgroup); - foreach (OdeCharacter actor in _characters) - { - actor.UpdatePosition(); - } - } - - public override void GetResults() - { - - } - - public override bool IsThreaded - { - get - { - return (false); // for now we won't be multithreaded - } - } - - public override void SetTerrain(float[] heightMap) - { - for (int i = 0; i < 65536; i++) - { - // this._heightmap[i] = (double)heightMap[i]; - // dbm (danx0r) -- heightmap x,y must be swapped for Ode (should fix ODE, but for now...) - int x = i & 0xff; - int y = i >> 8; - this._heightmap[i] = (double)heightMap[x * 256 + y]; - } - IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); - d.GeomHeightfieldDataBuildDouble(HeightmapData, _heightmap, 0, 256, 256, 256, 256, 1.0f, 0.0f, 2.0f, 0); - d.GeomHeightfieldDataSetBounds(HeightmapData, 256, 256); - LandGeom = d.CreateHeightfield(space, HeightmapData, 1); - d.Matrix3 R = new d.Matrix3(); - - Axiom.MathLib.Quaternion q1 =Axiom.MathLib.Quaternion.FromAngleAxis(1.5707f, new Axiom.MathLib.Vector3(1,0,0)); - Axiom.MathLib.Quaternion q2 =Axiom.MathLib.Quaternion.FromAngleAxis(1.5707f, new Axiom.MathLib.Vector3(0,1,0)); - //Axiom.MathLib.Quaternion q3 = Axiom.MathLib.Quaternion.FromAngleAxis(3.14f, new Axiom.MathLib.Vector3(0, 0, 1)); - - q1 = q1 * q2; - //q1 = q1 * q3; - Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(); - float angle = 0; - q1.ToAngleAxis(ref angle, ref v3); - - d.RFromAxisAndAngle(out R, v3.x, v3.y, v3.z, angle); - d.GeomSetRotation(LandGeom, ref R); - d.GeomSetPosition(LandGeom, 128, 128, 0); - } - - public override void DeleteTerrain() - { - - } - } - - public class OdeCharacter : PhysicsActor - { - private PhysicsVector _position; - private PhysicsVector _velocity; - private PhysicsVector _acceleration; - private bool flying = false; - //private float gravityAccel; - private IntPtr BoundingCapsule; - IntPtr capsule_geom; - d.Mass capsule_mass; - - public OdeCharacter(OdeScene parent_scene, PhysicsVector pos) - { - _velocity = new PhysicsVector(); - _position = pos; - _acceleration = new PhysicsVector(); - d.MassSetCapsule(out capsule_mass, 50.0f, 3, 0.5f, 2f); - capsule_geom = d.CreateSphere(OdeScene.space, 1.0f); /// not a typo! Spheres roll, capsules tumble - this.BoundingCapsule = d.BodyCreate(OdeScene.world); - d.BodySetMass(BoundingCapsule, ref capsule_mass); - d.BodySetPosition(BoundingCapsule, pos.X, pos.Y, pos.Z); - d.GeomSetBody(capsule_geom, BoundingCapsule); - } - - public override bool Flying - { - get - { - return flying; - } - set - { - flying = value; - } - } - - public override PhysicsVector Position - { - get - { - return _position; - } - set - { - _position = value; - } - } - - public override PhysicsVector Velocity - { - get - { - return _velocity; - } - set - { - _velocity = value; - } - } - - public override bool Kinematic - { - get - { - return false; - } - set - { - - } - } - - public override Axiom.MathLib.Quaternion Orientation - { - get - { - return Axiom.MathLib.Quaternion.Identity; - } - set - { - - } - } - - public override PhysicsVector Acceleration - { - get - { - return _acceleration; - } - - } - public void SetAcceleration(PhysicsVector accel) - { - this._acceleration = accel; - } - - public override void AddForce(PhysicsVector force) - { - - } - - public override void SetMomentum(PhysicsVector momentum) - { - - } - - public void Move(float timeStep) - { - PhysicsVector vec = new PhysicsVector(); - d.Vector3 vel = d.BodyGetLinearVel(BoundingCapsule); - vec.X = (vel.X - this._velocity.X) * -75000.0f; - vec.Y = (vel.Y - this._velocity.Y) * -75000.0f; - if (flying) - { - vec.Z = (vel.Z - this._velocity.Z) * -75000.0f; - } - d.BodyAddForce(this.BoundingCapsule, vec.X, vec.Y, vec.Z); - } - - public void UpdatePosition() - { - d.Vector3 vec = d.BodyGetPosition(BoundingCapsule); - this._position.X = vec.X; - this._position.Y = vec.Y; - this._position.Z = vec.Z; - } - } - - public class OdePrim : PhysicsActor - { - private PhysicsVector _position; - private PhysicsVector _velocity; - private PhysicsVector _acceleration; - - public OdePrim() - { - _velocity = new PhysicsVector(); - _position = new PhysicsVector(); - _acceleration = new PhysicsVector(); - } - public override bool Flying - { - get - { - return false; //no flying prims for you - } - set - { - - } - } - public override PhysicsVector Position - { - get - { - PhysicsVector pos = new PhysicsVector(); - // PhysicsVector vec = this._prim.Position; - //pos.X = vec.X; - //pos.Y = vec.Y; - //pos.Z = vec.Z; - return pos; - - } - set - { - /*PhysicsVector vec = value; - PhysicsVector pos = new PhysicsVector(); - pos.X = vec.X; - pos.Y = vec.Y; - pos.Z = vec.Z; - this._prim.Position = pos;*/ - } - } - - public override PhysicsVector Velocity - { - get - { - return _velocity; - } - set - { - _velocity = value; - } - } - - public override bool Kinematic - { - get - { - return false; - //return this._prim.Kinematic; - } - set - { - //this._prim.Kinematic = value; - } - } - - public override Axiom.MathLib.Quaternion Orientation - { - get - { - Axiom.MathLib.Quaternion res = new Axiom.MathLib.Quaternion(); - return res; - } - set - { - - } - } - - public override PhysicsVector Acceleration - { - get - { - return _acceleration; - } - - } - public void SetAcceleration(PhysicsVector accel) - { - this._acceleration = accel; - } - - public override void AddForce(PhysicsVector force) - { - - } - - public override void SetMomentum(PhysicsVector momentum) - { - - } - - - } - -} diff --git a/OpenSim/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.csproj b/OpenSim/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.csproj deleted file mode 100644 index 08f54aa..0000000 --- a/OpenSim/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.csproj +++ /dev/null @@ -1,97 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {63A05FE9-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Physics.OdePlugin - JScript - Grid - IE50 - false - Library - - OpenSim.Physics.OdePlugin - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\bin\Physics\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\bin\Physics\ - False - False - False - 4 - - - - - ..\..\..\bin\Axiom.MathLib.dll - False - - - ..\..\..\bin\Ode.NET.dll - False - - - System.dll - False - - - - - OpenSim.Physics.Manager - {8BE16150-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build b/OpenSim/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build deleted file mode 100644 index c93c0c2..0000000 --- a/OpenSim/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/OpenSim.Physics/PhysXPlugin/AssemblyInfo.cs b/OpenSim/OpenSim.Physics/PhysXPlugin/AssemblyInfo.cs deleted file mode 100644 index b49c8da..0000000 --- a/OpenSim/OpenSim.Physics/PhysXPlugin/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("RealPhysXplugin")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("RealPhysXplugin")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. -[assembly: ComVisible(false)] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly: AssemblyVersion("1.0.*")] diff --git a/OpenSim/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.csproj b/OpenSim/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.csproj deleted file mode 100644 index aa89cc1..0000000 --- a/OpenSim/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.csproj +++ /dev/null @@ -1,97 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {988F0AC4-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Physics.PhysXPlugin - JScript - Grid - IE50 - false - Library - - OpenSim.Physics.PhysXPlugin - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\bin\Physics\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\bin\Physics\ - False - False - False - 4 - - - - - ..\..\..\bin\Axiom.MathLib.dll - False - - - ..\..\..\bin\PhysX_Wrapper_Dotnet.dll - False - - - System.dll - False - - - - - OpenSim.Physics.Manager - {8BE16150-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build b/OpenSim/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build deleted file mode 100644 index be7a847..0000000 --- a/OpenSim/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OpenSim/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs deleted file mode 100644 index 802f983..0000000 --- a/OpenSim/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs +++ /dev/null @@ -1,424 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using OpenSim.Physics.Manager; -using PhysXWrapper; - -namespace OpenSim.Physics.PhysXPlugin -{ - /// - /// Will be the PhysX plugin but for now will be a very basic physics engine - /// - public class PhysXPlugin : IPhysicsPlugin - { - private PhysXScene _mScene; - - public PhysXPlugin() - { - - } - - public bool Init() - { - return true; - } - - public PhysicsScene GetScene() - { - if(_mScene == null) - { - _mScene = new PhysXScene(); - } - return(_mScene); - } - - public string GetName() - { - return("RealPhysX"); - } - - public void Dispose() - { - - } - } - - public class PhysXScene :PhysicsScene - { - private List _characters = new List(); - private List _prims = new List(); - private float[] _heightMap = null; - private NxPhysicsSDK mySdk; - private NxScene scene; - - public PhysXScene() - { - mySdk = NxPhysicsSDK.CreateSDK(); - Console.WriteLine("Sdk created - now creating scene"); - scene = mySdk.CreateScene(); - - } - - public override PhysicsActor AddAvatar(PhysicsVector position) - { - Vec3 pos = new Vec3(); - pos.X = position.X; - pos.Y = position.Y; - pos.Z = position.Z; - PhysXCharacter act = new PhysXCharacter( scene.AddCharacter(pos)); - act.Position = position; - _characters.Add(act); - return act; - } - - public override void RemoveAvatar(PhysicsActor actor) - { - - } - - public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) - { - Vec3 pos = new Vec3(); - pos.X = position.X; - pos.Y = position.Y; - pos.Z = position.Z; - Vec3 siz = new Vec3(); - siz.X = size.X; - siz.Y = size.Y; - siz.Z = size.Z; - PhysXPrim act = new PhysXPrim( scene.AddNewBox(pos, siz)); - _prims.Add(act); - return act; - } - public override void Simulate(float timeStep) - { - 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); - } - - } - - public override void GetResults() - { - - } - - public override bool IsThreaded - { - get - { - return(false); // for now we won't be multithreaded - } - } - - 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 - { - private PhysicsVector _position; - private PhysicsVector _velocity; - private PhysicsVector _acceleration; - private NxCharacter _character; - private bool flying; - private float gravityAccel; - - public PhysXCharacter(NxCharacter character) - { - _velocity = new PhysicsVector(); - _position = new PhysicsVector(); - _acceleration = new PhysicsVector(); - _character = character; - } - - public override bool Flying - { - get - { - return flying; - } - set - { - flying = value; - } - } - - public override PhysicsVector Position - { - get - { - return _position; - } - set - { - _position = value; - Vec3 ps = new Vec3(); - ps.X = value.X; - ps.Y = value.Y; - ps.Z = value.Z; - this._character.Position = ps; - } - } - - public override PhysicsVector Velocity - { - get - { - return _velocity; - } - set - { - _velocity = value; - } - } - - public override bool Kinematic - { - get - { - return false; - } - set - { - - } - } - - public override Axiom.MathLib.Quaternion Orientation - { - get - { - return Axiom.MathLib.Quaternion.Identity; - } - set - { - - } - } - - public override PhysicsVector Acceleration - { - get - { - return _acceleration; - } - - } - public void SetAcceleration (PhysicsVector accel) - { - this._acceleration = accel; - } - - public override void AddForce(PhysicsVector force) - { - - } - - public override void SetMomentum(PhysicsVector momentum) - { - - } - - public void Move(float timeStep) - { - Vec3 vec = new Vec3(); - vec.X = this._velocity.X * timeStep; - vec.Y = this._velocity.Y * timeStep; - if(flying) - { - vec.Z = ( this._velocity.Z) * timeStep; - } - else - { - gravityAccel+= -9.8f; - vec.Z = (gravityAccel + this._velocity.Z) * timeStep; - } - int res = this._character.Move(vec); - if(res == 1) - { - gravityAccel = 0; - } - } - - public void UpdatePosition() - { - Vec3 vec = this._character.Position; - this._position.X = vec.X; - this._position.Y = vec.Y; - this._position.Z = vec.Z; - } - } - - public class PhysXPrim : PhysicsActor - { - private PhysicsVector _position; - private PhysicsVector _velocity; - private PhysicsVector _acceleration; - private NxActor _prim; - - public PhysXPrim(NxActor prim) - { - _velocity = new PhysicsVector(); - _position = new PhysicsVector(); - _acceleration = new PhysicsVector(); - _prim = prim; - } - public override bool Flying - { - get - { - return false; //no flying prims for you - } - set - { - - } - } - public override PhysicsVector Position - { - get - { - PhysicsVector pos = new PhysicsVector(); - Vec3 vec = this._prim.Position; - pos.X = vec.X; - pos.Y = vec.Y; - pos.Z = vec.Z; - return pos; - - } - set - { - PhysicsVector vec = value; - Vec3 pos = new Vec3(); - pos.X = vec.X; - pos.Y = vec.Y; - pos.Z = vec.Z; - this._prim.Position = pos; - } - } - - public override PhysicsVector Velocity - { - get - { - return _velocity; - } - set - { - _velocity = value; - } - } - - public override bool Kinematic - { - get - { - return this._prim.Kinematic; - } - set - { - this._prim.Kinematic = value; - } - } - - public override Axiom.MathLib.Quaternion Orientation - { - get - { - Axiom.MathLib.Quaternion res = new Axiom.MathLib.Quaternion(); - PhysXWrapper.Quaternion quat = this._prim.GetOrientation(); - res.w = quat.W; - res.x = quat.X; - res.y = quat.Y; - res.z = quat.Z; - return res; - } - set - { - - } - } - - public override PhysicsVector Acceleration - { - get - { - return _acceleration; - } - - } - public void SetAcceleration (PhysicsVector accel) - { - this._acceleration = accel; - } - - public override void AddForce(PhysicsVector force) - { - - } - - public override void SetMomentum(PhysicsVector momentum) - { - - } - - - } - -} -- cgit v1.1