From 8b8f62f0191c31a045913edec702ca23fab5f6d6 Mon Sep 17 00:00:00 2001 From: gareth Date: Tue, 27 Mar 2007 02:42:06 +0000 Subject: ODE plugin now can fly but sinks through ground when walking (?!!!??!??!) --- .../OpenGridServices.GridServer.exe.build | 98 ++++----- .../OpenGridServices.ServerConsole.dll.build | 86 ++++---- .../OpenGridServices.UserServer.exe.build | 96 ++++----- .../OpenSim.Config.SimConfigDb4o.dll.build | 94 ++++----- .../OpenSim.Framework.Console.dll.build | 82 ++++---- OpenSim.Framework/OpenSim.Framework.dll.build | 126 ++++++------ .../Local/OpenSim.GridInterfaces.Local.dll.build | 92 ++++----- .../Remote/OpenSim.GridInterfaces.Remote.dll.build | 90 ++++----- .../OpenSim.Physics.BasicPhysicsPlugin.dll.build | 84 ++++---- .../Manager/OpenSim.Physics.Manager.dll.build | 92 ++++----- OpenSim.Physics/OdePlugin/OdePlugin.cs | 70 +++++-- .../OdePlugin/OpenSim.Physics.OdePlugin.dll.build | 86 ++++---- .../OpenSim.Physics.PhysXPlugin.dll.build | 86 ++++---- .../OpenSim.RegionServer.dll.build | 138 ++++++------- .../OpenSim.Storage.LocalStorageDb4o.dll.build | 92 ++++----- OpenSim.build | 218 ++++++++++----------- OpenSim/OpenSim.exe.build | 94 ++++----- Prebuild/Prebuild.build | 134 ++++++------- Prebuild/src/Prebuild.exe.build | 160 +++++++-------- 19 files changed, 1024 insertions(+), 994 deletions(-) diff --git a/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build b/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build index a054143..e119279 100644 --- a/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build +++ b/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build @@ -1,49 +1,49 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenGridServices.ServerConsole/OpenGridServices.ServerConsole.dll.build b/OpenGridServices.ServerConsole/OpenGridServices.ServerConsole.dll.build index 270f925..2e6ec3e 100644 --- a/OpenGridServices.ServerConsole/OpenGridServices.ServerConsole.dll.build +++ b/OpenGridServices.ServerConsole/OpenGridServices.ServerConsole.dll.build @@ -1,43 +1,43 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build b/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build index f4e58d9..710b01b 100644 --- a/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build +++ b/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build @@ -1,48 +1,48 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim.Config/SimConfigDb4o/OpenSim.Config.SimConfigDb4o.dll.build b/OpenSim.Config/SimConfigDb4o/OpenSim.Config.SimConfigDb4o.dll.build index 3dfa7ce..703abe6 100644 --- a/OpenSim.Config/SimConfigDb4o/OpenSim.Config.SimConfigDb4o.dll.build +++ b/OpenSim.Config/SimConfigDb4o/OpenSim.Config.SimConfigDb4o.dll.build @@ -1,47 +1,47 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build b/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build index 9ceaea6..2dfc9b0 100644 --- a/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build +++ b/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build @@ -1,41 +1,41 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim.Framework/OpenSim.Framework.dll.build b/OpenSim.Framework/OpenSim.Framework.dll.build index 79bbf05..a5ec58c 100644 --- a/OpenSim.Framework/OpenSim.Framework.dll.build +++ b/OpenSim.Framework/OpenSim.Framework.dll.build @@ -1,63 +1,63 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build b/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build index ec65ba8..e3b33cb 100644 --- a/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build +++ b/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build @@ -1,46 +1,46 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build b/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build index 2060454..01bf0df 100644 --- a/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build +++ b/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build @@ -1,45 +1,45 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build b/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build index f146733..4217a06 100644 --- a/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build +++ b/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build @@ -1,42 +1,42 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build b/OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build index 47e5534..4aaca6a 100644 --- a/OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build +++ b/OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build @@ -1,46 +1,46 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim.Physics/OdePlugin/OdePlugin.cs b/OpenSim.Physics/OdePlugin/OdePlugin.cs index 352084c..01eaf77 100644 --- a/OpenSim.Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim.Physics/OdePlugin/OdePlugin.cs @@ -70,31 +70,54 @@ namespace OpenSim.Physics.OdePlugin public class OdeScene :PhysicsScene { - public IntPtr world; - public IntPtr space; - private IntPtr contactgroup; + 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[500]; + private static d.Contact contact; - public OdeScene() - { + public OdeScene() { world = d.WorldCreate(); space = d.HashSpaceCreate(IntPtr.Zero); contactgroup = d.JointGroupCreate(0); d.WorldSetGravity(world, 0.0f, 0.0f, -0.5f); d.WorldSetCFM(world, 1e-5f); - d.WorldSetAutoDisableFlag(world, true); - d.WorldSetContactMaxCorrectingVel(world, 0.1f); - d.WorldSetContactSurfaceLayer(world, 0.001f); + d.WorldSetAutoDisableFlag(world, false); 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; - return new OdeCharacter(this,pos); + OdeCharacter newAv= new OdeCharacter(this,pos); + this._characters.Add(newAv); + return newAv; } public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) @@ -112,7 +135,16 @@ namespace OpenSim.Physics.OdePlugin public override void Simulate(float timeStep) { - + foreach (OdeCharacter actor in _characters) { + actor.Move(timeStep*5f); + } + d.SpaceCollide(space, IntPtr.Zero, nearCallback); + d.WorldQuickStep(world, timeStep*5f); + foreach (OdeCharacter actor in _characters) + { + actor.UpdatePosition(); + } + } public override void GetResults() @@ -135,7 +167,8 @@ namespace OpenSim.Physics.OdePlugin } IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); d.GeomHeightfieldDataBuildDouble(HeightmapData,_heightmap,1,256,256,256,256,1.0f,0.0f,2.0f,0); - d.CreateHeightfield(space, HeightmapData, 0); + LandGeom=d.CreateHeightfield(space, HeightmapData, 1); + d.GeomSetPosition(LandGeom,0,0,0); } } @@ -156,7 +189,10 @@ namespace OpenSim.Physics.OdePlugin _position = pos; _acceleration = new PhysicsVector(); d.MassSetCapsule(out capsule_mass, 5.0f, 3, 0.5f, 2f); - capsule_geom = d.CreateCapsule(parent_scene.space, 0.5f, 2f); + capsule_geom = d.CreateCapsule(OdeScene.space, 0.5f, 2f); + this.BoundingCapsule=d.BodyCreate(OdeScene.world); + d.BodySetMass(BoundingCapsule, ref capsule_mass); + d.BodySetPosition(BoundingCapsule,pos.X,pos.Y,pos.Z); } public override bool Flying @@ -249,12 +285,7 @@ namespace OpenSim.Physics.OdePlugin 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; + vec.Z = ( this._velocity.Z+0.5f) * timeStep; } d.BodySetLinearVel(this.BoundingCapsule, vec.X, vec.Y, vec.Z); } @@ -265,7 +296,6 @@ namespace OpenSim.Physics.OdePlugin this._position.X = vec.X; this._position.Y = vec.Y; this._position.Z = vec.Z; - } } @@ -297,7 +327,7 @@ namespace OpenSim.Physics.OdePlugin get { PhysicsVector pos = new PhysicsVector(); - //PhysicsVector vec = this._prim.Position; + // PhysicsVector vec = this._prim.Position; //pos.X = vec.X; //pos.Y = vec.Y; //pos.Z = vec.Z; diff --git a/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build b/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build index c67d820..e738ab1 100644 --- a/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build +++ b/OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build @@ -1,43 +1,43 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build b/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build index 8f9e7dc..395cc6b 100644 --- a/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build +++ b/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build @@ -1,43 +1,43 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build index 66d55fb..dced3ae 100644 --- a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build +++ b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build @@ -1,69 +1,69 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build b/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build index 44e8597..ebcda17 100644 --- a/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build +++ b/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build @@ -1,46 +1,46 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim.build b/OpenSim.build index 972331b..a15f8da 100644 --- a/OpenSim.build +++ b/OpenSim.build @@ -1,109 +1,109 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/OpenSim.exe.build b/OpenSim/OpenSim.exe.build index 7d69d90..fc516df 100644 --- a/OpenSim/OpenSim.exe.build +++ b/OpenSim/OpenSim.exe.build @@ -1,47 +1,47 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prebuild/Prebuild.build b/Prebuild/Prebuild.build index 395fb31..743b826 100644 --- a/Prebuild/Prebuild.build +++ b/Prebuild/Prebuild.build @@ -1,67 +1,67 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prebuild/src/Prebuild.exe.build b/Prebuild/src/Prebuild.exe.build index 43f5516..628e7e1 100644 --- a/Prebuild/src/Prebuild.exe.build +++ b/Prebuild/src/Prebuild.exe.build @@ -1,80 +1,80 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.1