diff options
-rw-r--r-- | OpenSim.Physics/OdePlugin/OdePlugin.cs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/OpenSim.Physics/OdePlugin/OdePlugin.cs b/OpenSim.Physics/OdePlugin/OdePlugin.cs index cb96533..3337a37 100644 --- a/OpenSim.Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim.Physics/OdePlugin/OdePlugin.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | using System; | 27 | using System; |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using OpenSim.Physics.Manager; | 29 | using OpenSim.Physics.Manager; |
30 | using Ode.NET; | ||
30 | 31 | ||
31 | namespace OpenSim.Physics.OdePlugin | 32 | namespace OpenSim.Physics.OdePlugin |
32 | { | 33 | { |
@@ -69,10 +70,21 @@ namespace OpenSim.Physics.OdePlugin | |||
69 | 70 | ||
70 | public class OdeScene :PhysicsScene | 71 | public class OdeScene :PhysicsScene |
71 | { | 72 | { |
72 | 73 | private IntPtr world; | |
74 | private IntPtr space; | ||
75 | private IntPtr contactgroup; | ||
76 | private double[] _heightmap; | ||
77 | |||
73 | public OdeScene() | 78 | public OdeScene() |
74 | { | 79 | { |
75 | 80 | world = d.WorldCreate(); | |
81 | space = d.HashSpaceCreate(IntPtr.Zero); | ||
82 | contactgroup = d.JointGroupCreate(0); | ||
83 | d.WorldSetGravity(world, 0.0f, 0.0f, -0.5f); | ||
84 | d.WorldSetCFM(world, 1e-5f); | ||
85 | d.WorldSetAutoDisableFlag(world, true); | ||
86 | d.WorldSetContactMaxCorrectingVel(world, 0.1f); | ||
87 | d.WorldSetContactSurfaceLayer(world, 0.001f); | ||
76 | } | 88 | } |
77 | 89 | ||
78 | public override PhysicsActor AddAvatar(PhysicsVector position) | 90 | public override PhysicsActor AddAvatar(PhysicsVector position) |
@@ -117,6 +129,12 @@ namespace OpenSim.Physics.OdePlugin | |||
117 | 129 | ||
118 | public override void SetTerrain(float[] heightMap) | 130 | public override void SetTerrain(float[] heightMap) |
119 | { | 131 | { |
132 | for(int i=0; i<65536; i++) { | ||
133 | this._heightmap[i]=(double)heightMap[i]; | ||
134 | } | ||
135 | IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); | ||
136 | d.GeomHeightfieldDataBuildDouble(HeightmapData,_heightmap,1,256,256,256,256,1.0f,0.0f,2.0f,0); | ||
137 | d.CreateHeightfield(space, HeightmapData, 0); | ||
120 | } | 138 | } |
121 | } | 139 | } |
122 | 140 | ||