diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 5 | ||||
-rw-r--r-- | OpenSim.Physics/Manager/PhysicsScene.cs | 9 | ||||
-rw-r--r-- | OpenSim.Physics/OdePlugin/OdePlugin.cs | 5 | ||||
-rw-r--r-- | OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs | 50 |
4 files changed, 55 insertions, 14 deletions
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 | |||
149 | { | 149 | { |
150 | this._heightMap = heightMap; | 150 | this._heightMap = heightMap; |
151 | } | 151 | } |
152 | |||
153 | public override void DeleteTerrain() | ||
154 | { | ||
155 | |||
156 | } | ||
152 | } | 157 | } |
153 | 158 | ||
154 | public class BasicActor : PhysicsActor | 159 | 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 | |||
50 | public abstract void GetResults(); | 50 | public abstract void GetResults(); |
51 | 51 | ||
52 | public abstract void SetTerrain(float[] heightMap); | 52 | public abstract void SetTerrain(float[] heightMap); |
53 | |||
54 | public abstract void DeleteTerrain(); | ||
53 | 55 | ||
54 | public abstract bool IsThreaded | 56 | public abstract bool IsThreaded |
55 | { | 57 | { |
@@ -76,6 +78,8 @@ namespace OpenSim.Physics.Manager | |||
76 | public override void Simulate(float timeStep) | 78 | public override void Simulate(float timeStep) |
77 | { | 79 | { |
78 | m_workIndicator = (m_workIndicator + 1) % 10; | 80 | m_workIndicator = (m_workIndicator + 1) % 10; |
81 | |||
82 | //OpenSim.Framework.Console.MainConsole.Instance.SetStatus(m_workIndicator.ToString()); | ||
79 | } | 83 | } |
80 | 84 | ||
81 | public override void GetResults() | 85 | public override void GetResults() |
@@ -88,6 +92,11 @@ namespace OpenSim.Physics.Manager | |||
88 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length); | 92 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length); |
89 | } | 93 | } |
90 | 94 | ||
95 | public override void DeleteTerrain() | ||
96 | { | ||
97 | |||
98 | } | ||
99 | |||
91 | public override bool IsThreaded | 100 | public override bool IsThreaded |
92 | { | 101 | { |
93 | get { return false; } | 102 | 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 | |||
170 | d.GeomHeightfieldDataBuildDouble(HeightmapData,_heightmap,1,256,256,256,256,1.0f,0.0f,2.0f,0); | 170 | d.GeomHeightfieldDataBuildDouble(HeightmapData,_heightmap,1,256,256,256,256,1.0f,0.0f,2.0f,0); |
171 | LandGeom=d.CreateHeightfield(space, HeightmapData, 0); | 171 | LandGeom=d.CreateHeightfield(space, HeightmapData, 0); |
172 | } | 172 | } |
173 | |||
174 | public override void DeleteTerrain() | ||
175 | { | ||
176 | |||
177 | } | ||
173 | } | 178 | } |
174 | 179 | ||
175 | public class OdeCharacter : PhysicsActor | 180 | 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 | |||
98 | { | 98 | { |
99 | private List<PhysXCharacter> _characters = new List<PhysXCharacter>(); | 99 | private List<PhysXCharacter> _characters = new List<PhysXCharacter>(); |
100 | private List<PhysXPrim> _prims = new List<PhysXPrim>(); | 100 | private List<PhysXPrim> _prims = new List<PhysXPrim>(); |
101 | private float[] _heightMap; | 101 | private float[] _heightMap = null; |
102 | private NxPhysicsSDK mySdk; | 102 | private NxPhysicsSDK mySdk; |
103 | private NxScene scene; | 103 | private NxScene scene; |
104 | 104 | ||
@@ -138,18 +138,25 @@ namespace OpenSim.Physics.PhysXPlugin | |||
138 | } | 138 | } |
139 | public override void Simulate(float timeStep) | 139 | public override void Simulate(float timeStep) |
140 | { | 140 | { |
141 | foreach (PhysXCharacter actor in _characters) | 141 | try |
142 | { | 142 | { |
143 | actor.Move(timeStep); | 143 | foreach (PhysXCharacter actor in _characters) |
144 | } | 144 | { |
145 | scene.Simulate(timeStep); | 145 | actor.Move(timeStep); |
146 | scene.FetchResults(); | 146 | } |
147 | scene.UpdateControllers(); | 147 | scene.Simulate(timeStep); |
148 | 148 | scene.FetchResults(); | |
149 | foreach (PhysXCharacter actor in _characters) | 149 | scene.UpdateControllers(); |
150 | { | 150 | |
151 | actor.UpdatePosition(); | 151 | foreach (PhysXCharacter actor in _characters) |
152 | } | 152 | { |
153 | actor.UpdatePosition(); | ||
154 | } | ||
155 | } | ||
156 | catch (Exception e) | ||
157 | { | ||
158 | Console.WriteLine(e.Message); | ||
159 | } | ||
153 | 160 | ||
154 | } | 161 | } |
155 | 162 | ||
@@ -168,10 +175,20 @@ namespace OpenSim.Physics.PhysXPlugin | |||
168 | 175 | ||
169 | public override void SetTerrain(float[] heightMap) | 176 | public override void SetTerrain(float[] heightMap) |
170 | { | 177 | { |
178 | if (this._heightMap != null) | ||
179 | { | ||
180 | Console.WriteLine("PhysX - deleting old terrain"); | ||
181 | this.scene.DeleteTerrain(); | ||
182 | } | ||
171 | this._heightMap = heightMap; | 183 | this._heightMap = heightMap; |
172 | this.scene.AddTerrain(heightMap); | 184 | this.scene.AddTerrain(heightMap); |
173 | } | 185 | } |
174 | } | 186 | |
187 | public override void DeleteTerrain() | ||
188 | { | ||
189 | this.scene.DeleteTerrain(); | ||
190 | } | ||
191 | } | ||
175 | 192 | ||
176 | public class PhysXCharacter : PhysicsActor | 193 | public class PhysXCharacter : PhysicsActor |
177 | { | 194 | { |
@@ -211,6 +228,11 @@ namespace OpenSim.Physics.PhysXPlugin | |||
211 | set | 228 | set |
212 | { | 229 | { |
213 | _position = value; | 230 | _position = value; |
231 | Vec3 ps = new Vec3(); | ||
232 | ps.X = value.X; | ||
233 | ps.Y = value.Y; | ||
234 | ps.Z = value.Z; | ||
235 | this._character.Position = ps; | ||
214 | } | 236 | } |
215 | } | 237 | } |
216 | 238 | ||