ODE plugin now can fly but sinks through ground when walking (?!!!??!??!)

tourmaline
gareth 2007-03-27 02:42:06 +00:00
parent 60385e7525
commit 8b8f62f019
19 changed files with 1024 additions and 994 deletions

View File

@ -7,7 +7,7 @@
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
<csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
<resources prefix="OpenGridServices.GridServer" dynamicprefix="true" >
</resources>
<sources failonempty="true">

View File

@ -7,7 +7,7 @@
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<resources prefix="OpenGridServices.ServerConsole" dynamicprefix="true" >
</resources>
<sources failonempty="true">

View File

@ -7,7 +7,7 @@
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
<csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
<resources prefix="OpenGridServices.UserServer" dynamicprefix="true" >
</resources>
<sources failonempty="true">

View File

@ -7,7 +7,7 @@
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<resources prefix="OpenSim.Config.SimConfigDb4o" dynamicprefix="true" >
</resources>
<sources failonempty="true">

View File

@ -7,7 +7,7 @@
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<resources prefix="OpenSim.Framework.Console" dynamicprefix="true" >
</resources>
<sources failonempty="true">

View File

@ -7,7 +7,7 @@
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<resources prefix="OpenSim.Framework" dynamicprefix="true" >
</resources>
<sources failonempty="true">

View File

@ -7,7 +7,7 @@
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<resources prefix="OpenSim.GridInterfaces.Local" dynamicprefix="true" >
</resources>
<sources failonempty="true">

View File

@ -7,7 +7,7 @@
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<resources prefix="OpenSim.GridInterfaces.Remote" dynamicprefix="true" >
</resources>
<sources failonempty="true">

View File

@ -7,7 +7,7 @@
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<resources prefix="OpenSim.Physics.BasicPhysicsPlugin" dynamicprefix="true" >
</resources>
<sources failonempty="true">

View File

@ -7,7 +7,7 @@
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<resources prefix="OpenSim.Physics.Manager" dynamicprefix="true" >
</resources>
<sources failonempty="true">

View File

@ -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<OdeCharacter> _characters = new List<OdeCharacter>();
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,6 +135,15 @@ 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();
}
}
@ -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;

View File

@ -7,7 +7,7 @@
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<resources prefix="OpenSim.Physics.OdePlugin" dynamicprefix="true" >
</resources>
<sources failonempty="true">

View File

@ -7,7 +7,7 @@
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<resources prefix="OpenSim.Physics.PhysXPlugin" dynamicprefix="true" >
</resources>
<sources failonempty="true">

View File

@ -7,7 +7,7 @@
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<resources prefix="OpenSim.RegionServer" dynamicprefix="true" >
</resources>
<sources failonempty="true">
@ -23,10 +23,10 @@
<include name="Assets/AssetCache.cs" />
<include name="Assets/InventoryCache.cs" />
<include name="CAPS/SimHttp.cs" />
<include name="types/Mesh.cs" />
<include name="types/Triangle.cs" />
<include name="UserServer/LocalUserProfileManager.cs" />
<include name="UserServer/LoginServer.cs" />
<include name="types/Mesh.cs" />
<include name="types/Triangle.cs" />
<include name="world/Avatar.cs" />
<include name="world/AvatarAnimations.cs" />
<include name="world/Entity.cs" />

View File

@ -7,7 +7,7 @@
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<csc target="library" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
<resources prefix="OpenSim.Storage.LocalStorageDb4o" dynamicprefix="true" >
</resources>
<sources failonempty="true">

View File

@ -6,12 +6,6 @@
<property name="obj.dir" value="obj" />
<property name="doc.dir" value="doc" />
<property name="project.main.dir" value="${project::get-base-directory()}" />
<target name="Debug" description="">
<property name="project.config" value="Debug" />
<property name="build.debug" value="true" />
</target>
<property name="project.config" value="Release" />
<target name="Release" description="">
@ -19,6 +13,12 @@
<property name="build.debug" value="false" />
</target>
<target name="Debug" description="">
<property name="project.config" value="Debug" />
<property name="build.debug" value="true" />
</target>
<target name="net-1.1" description="Sets framework to .NET 1.1">
<property name="nant.settings.currentframework" value="net-1.1" />
</target>
@ -46,21 +46,21 @@
<echo message="Deleting all builds from all configurations" />
<delete dir="${bin.dir}" failonerror="false" />
<delete dir="${obj.dir}" failonerror="false" />
<nant buildfile="OpenGridServices.ServerConsole/OpenGridServices.ServerConsole.dll.build" target="clean" />
<nant buildfile="OpenSim.Framework/OpenSim.Framework.dll.build" target="clean" />
<nant buildfile="OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build" target="clean" />
<nant buildfile="OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build" target="clean" />
<nant buildfile="OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build" target="clean" />
<nant buildfile="OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build" target="clean" />
<nant buildfile="OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build" target="clean" />
<nant buildfile="OpenSim.Config/SimConfigDb4o/OpenSim.Config.SimConfigDb4o.dll.build" target="clean" />
<nant buildfile="OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build" target="clean" />
<nant buildfile="OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build" target="clean" />
<nant buildfile="OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build" target="clean" />
<nant buildfile="OpenSim.Framework/OpenSim.Framework.dll.build" target="clean" />
<nant buildfile="OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build" target="clean" />
<nant buildfile="OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build" target="clean" />
<nant buildfile="OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build" target="clean" />
<nant buildfile="OpenSim/OpenSim.exe.build" target="clean" />
<nant buildfile="OpenSim.RegionServer/OpenSim.RegionServer.dll.build" target="clean" />
<nant buildfile="OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build" target="clean" />
<nant buildfile="OpenGridServices.ServerConsole/OpenGridServices.ServerConsole.dll.build" target="clean" />
<nant buildfile="OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build" target="clean" />
<nant buildfile="OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build" target="clean" />
<nant buildfile="OpenSim/OpenSim.exe.build" target="clean" />
<nant buildfile="OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build" target="clean" />
<nant buildfile="OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build" target="clean" />
<nant buildfile="OpenSim.RegionServer/OpenSim.RegionServer.dll.build" target="clean" />
</target>
<target name="build" depends="init" description="">
@ -89,21 +89,21 @@
<target name="doc" depends="build-release">
<echo message="Generating all documentation from all builds" />
<nant buildfile="OpenGridServices.ServerConsole/OpenGridServices.ServerConsole.dll.build" target="doc" />
<nant buildfile="OpenSim.Framework/OpenSim.Framework.dll.build" target="doc" />
<nant buildfile="OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build" target="doc" />
<nant buildfile="OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build" target="doc" />
<nant buildfile="OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build" target="doc" />
<nant buildfile="OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build" target="doc" />
<nant buildfile="OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build" target="doc" />
<nant buildfile="OpenSim.Config/SimConfigDb4o/OpenSim.Config.SimConfigDb4o.dll.build" target="doc" />
<nant buildfile="OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build" target="doc" />
<nant buildfile="OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build" target="doc" />
<nant buildfile="OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build" target="doc" />
<nant buildfile="OpenSim.Framework/OpenSim.Framework.dll.build" target="doc" />
<nant buildfile="OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build" target="doc" />
<nant buildfile="OpenSim.Physics/OdePlugin/OpenSim.Physics.OdePlugin.dll.build" target="doc" />
<nant buildfile="OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build" target="doc" />
<nant buildfile="OpenSim/OpenSim.exe.build" target="doc" />
<nant buildfile="OpenSim.RegionServer/OpenSim.RegionServer.dll.build" target="doc" />
<nant buildfile="OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build" target="doc" />
<nant buildfile="OpenGridServices.ServerConsole/OpenGridServices.ServerConsole.dll.build" target="doc" />
<nant buildfile="OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build" target="doc" />
<nant buildfile="OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build" target="doc" />
<nant buildfile="OpenSim/OpenSim.exe.build" target="doc" />
<nant buildfile="OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build" target="doc" />
<nant buildfile="OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build" target="doc" />
<nant buildfile="OpenSim.RegionServer/OpenSim.RegionServer.dll.build" target="doc" />
</target>
</project>

View File

@ -7,7 +7,7 @@
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
<csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
<resources prefix="OpenSim" dynamicprefix="true" >
</resources>
<sources failonempty="true">

View File

@ -6,12 +6,6 @@
<property name="obj.dir" value="obj" />
<property name="doc.dir" value="doc" />
<property name="project.main.dir" value="${project::get-base-directory()}" />
<target name="Debug" description="">
<property name="project.config" value="Debug" />
<property name="build.debug" value="true" />
</target>
<property name="project.config" value="Release" />
<target name="Release" description="">
@ -19,6 +13,12 @@
<property name="build.debug" value="false" />
</target>
<target name="Debug" description="">
<property name="project.config" value="Debug" />
<property name="build.debug" value="true" />
</target>
<target name="net-1.1" description="Sets framework to .NET 1.1">
<property name="nant.settings.currentframework" value="net-1.1" />
</target>

View File

@ -7,7 +7,7 @@
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="exe" debug="${build.debug}" keyfile="Prebuild.snk" unsafe="False" define="DEBUG;TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe" win32icon="App.ico">
<csc target="exe" debug="${build.debug}" keyfile="Prebuild.snk" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe" win32icon="App.ico">
<resources prefix="Prebuild" dynamicprefix="true" >
<include name="App.ico" />
<include name="data/prebuild-1.7.xsd" />