aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorSean Dague2007-07-16 15:40:11 +0000
committerSean Dague2007-07-16 15:40:11 +0000
commit2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6 (patch)
treee3f80ad51736cf17e856547b1bcf956010927434 /OpenSim/Region/Physics
parent*Trunk compiles now (diff)
downloadopensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.zip
opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.gz
opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.bz2
opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.xz
changed to native line ending encoding
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs112
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs602
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs112
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs1068
-rw-r--r--OpenSim/Region/Physics/Manager/AssemblyInfo.cs112
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs334
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsManager.cs230
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs220
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsVector.cs110
-rw-r--r--OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs112
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs914
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs112
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs850
13 files changed, 2444 insertions, 2444 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
index ce567a9..ecf8e68 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
@@ -1,56 +1,56 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following 30// Information about this assembly is defined by the following
31// attributes. 31// attributes.
32// 32//
33// change them to the information which is associated with the assembly 33// change them to the information which is associated with the assembly
34// you compile. 34// you compile.
35 35
36[assembly: AssemblyTitle("PhysXplugin")] 36[assembly: AssemblyTitle("PhysXplugin")]
37[assembly: AssemblyDescription("")] 37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 39[assembly: AssemblyCompany("")]
40[assembly: AssemblyProduct("PhysXplugin")] 40[assembly: AssemblyProduct("PhysXplugin")]
41[assembly: AssemblyCopyright("")] 41[assembly: AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 43[assembly: AssemblyCulture("")]
44 44
45// This sets the default COM visibility of types in the assembly to invisible. 45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 47[assembly: ComVisible(false)]
48 48
49// The assembly version has following format : 49// The assembly version has following format :
50// 50//
51// Major.Minor.Build.Revision 51// Major.Minor.Build.Revision
52// 52//
53// You can specify all values by your own or you can build default build and revision 53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 54// numbers with the '*' character (the default):
55 55
56[assembly: AssemblyVersion("1.0.*")] 56[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index f133045..ec406f1 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -1,301 +1,301 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using Axiom.Math; 29using Axiom.Math;
30using OpenSim.Physics.Manager; 30using OpenSim.Physics.Manager;
31 31
32namespace OpenSim.Region.Physics.BasicPhysicsPlugin 32namespace OpenSim.Region.Physics.BasicPhysicsPlugin
33{ 33{
34 /// <summary> 34 /// <summary>
35 /// Will be the PhysX plugin but for now will be a very basic physics engine 35 /// Will be the PhysX plugin but for now will be a very basic physics engine
36 /// </summary> 36 /// </summary>
37 public class BasicPhysicsPlugin : IPhysicsPlugin 37 public class BasicPhysicsPlugin : IPhysicsPlugin
38 { 38 {
39 private BasicScene _mScene; 39 private BasicScene _mScene;
40 40
41 public BasicPhysicsPlugin() 41 public BasicPhysicsPlugin()
42 { 42 {
43 43
44 } 44 }
45 45
46 public bool Init() 46 public bool Init()
47 { 47 {
48 return true; 48 return true;
49 } 49 }
50 50
51 public PhysicsScene GetScene() 51 public PhysicsScene GetScene()
52 { 52 {
53 return new BasicScene(); 53 return new BasicScene();
54 } 54 }
55 55
56 public string GetName() 56 public string GetName()
57 { 57 {
58 return("basicphysics"); 58 return("basicphysics");
59 } 59 }
60 60
61 public void Dispose() 61 public void Dispose()
62 { 62 {
63 63
64 } 64 }
65 } 65 }
66 66
67 public class BasicScene :PhysicsScene 67 public class BasicScene :PhysicsScene
68 { 68 {
69 private List<BasicActor> _actors = new List<BasicActor>(); 69 private List<BasicActor> _actors = new List<BasicActor>();
70 private float[] _heightMap; 70 private float[] _heightMap;
71 71
72 public BasicScene() 72 public BasicScene()
73 { 73 {
74 74
75 } 75 }
76 76
77 public override PhysicsActor AddAvatar(PhysicsVector position) 77 public override PhysicsActor AddAvatar(PhysicsVector position)
78 { 78 {
79 BasicActor act = new BasicActor(); 79 BasicActor act = new BasicActor();
80 act.Position = position; 80 act.Position = position;
81 _actors.Add(act); 81 _actors.Add(act);
82 return act; 82 return act;
83 } 83 }
84 84
85 public override void RemoveAvatar(PhysicsActor actor) 85 public override void RemoveAvatar(PhysicsActor actor)
86 { 86 {
87 BasicActor act = (BasicActor)actor; 87 BasicActor act = (BasicActor)actor;
88 if(_actors.Contains(act)) 88 if(_actors.Contains(act))
89 { 89 {
90 _actors.Remove(act); 90 _actors.Remove(act);
91 } 91 }
92 92
93 } 93 }
94 94
95 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) 95 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size)
96 { 96 {
97 return null; 97 return null;
98 } 98 }
99 99
100 public override void Simulate(float timeStep) 100 public override void Simulate(float timeStep)
101 { 101 {
102 foreach (BasicActor actor in _actors) 102 foreach (BasicActor actor in _actors)
103 { 103 {
104 if ((actor.Position.Y > 0 && actor.Position.Y < 256) && (actor.Position.X > 0 && actor.Position.X < 256)) 104 if ((actor.Position.Y > 0 && actor.Position.Y < 256) && (actor.Position.X > 0 && actor.Position.X < 256))
105 { 105 {
106 float height = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1.2f; 106 float height = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1.2f;
107 actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep); 107 actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep);
108 actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep); 108 actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep);
109 if (actor.Flying) 109 if (actor.Flying)
110 { 110 {
111 if (actor.Position.Z + (actor.Velocity.Z * timeStep) < 111 if (actor.Position.Z + (actor.Velocity.Z * timeStep) <
112 _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 2) 112 _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 2)
113 { 113 {
114 actor.Position.Z = height; 114 actor.Position.Z = height;
115 actor.Velocity.Z = 0; 115 actor.Velocity.Z = 0;
116 } 116 }
117 else 117 else
118 { 118 {
119 actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep); 119 actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep);
120 } 120 }
121 } 121 }
122 else 122 else
123 { 123 {
124 actor.Position.Z = height; 124 actor.Position.Z = height;
125 actor.Velocity.Z = 0; 125 actor.Velocity.Z = 0;
126 } 126 }
127 } 127 }
128 else 128 else
129 { 129 {
130 if (actor.Position.Y < 0) 130 if (actor.Position.Y < 0)
131 { 131 {
132 actor.Position.Y = 0; 132 actor.Position.Y = 0;
133 } 133 }
134 else if (actor.Position.Y > 256) 134 else if (actor.Position.Y > 256)
135 { 135 {
136 actor.Position.Y = 256; 136 actor.Position.Y = 256;
137 } 137 }
138 138
139 if (actor.Position.X < 0) 139 if (actor.Position.X < 0)
140 { 140 {
141 actor.Position.X = 0; 141 actor.Position.X = 0;
142 } 142 }
143 if (actor.Position.X > 256) 143 if (actor.Position.X > 256)
144 { 144 {
145 actor.Position.X = 256; 145 actor.Position.X = 256;
146 } 146 }
147 } 147 }
148 //} 148 //}
149 149
150 150
151 151
152 // This code needs sorting out - border crossings etc 152 // This code needs sorting out - border crossings etc
153/* if(actor.Position.X<0) 153/* if(actor.Position.X<0)
154 { 154 {
155 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); 155 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z));
156 actor.Position.X = 0; 156 actor.Position.X = 0;
157 actor.Velocity.X = 0; 157 actor.Velocity.X = 0;
158 } 158 }
159 if(actor.Position.Y < 0) 159 if(actor.Position.Y < 0)
160 { 160 {
161 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); 161 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z));
162 actor.Position.Y = 0; 162 actor.Position.Y = 0;
163 actor.Velocity.Y = 0; 163 actor.Velocity.Y = 0;
164 } 164 }
165 if(actor.Position.X > 255) 165 if(actor.Position.X > 255)
166 { 166 {
167 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); 167 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z));
168 actor.Position.X = 255; 168 actor.Position.X = 255;
169 actor.Velocity.X = 0; 169 actor.Velocity.X = 0;
170 } 170 }
171 if(actor.Position.Y > 255) 171 if(actor.Position.Y > 255)
172 { 172 {
173 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z)); 173 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z));
174 actor.Position.Y = 255; 174 actor.Position.Y = 255;
175 actor.Velocity.X = 0; 175 actor.Velocity.X = 0;
176 }*/ 176 }*/
177 } 177 }
178 } 178 }
179 179
180 public override void GetResults() 180 public override void GetResults()
181 { 181 {
182 182
183 } 183 }
184 184
185 public override bool IsThreaded 185 public override bool IsThreaded
186 { 186 {
187 get 187 get
188 { 188 {
189 return(false); // for now we won't be multithreaded 189 return(false); // for now we won't be multithreaded
190 } 190 }
191 } 191 }
192 192
193 public override void SetTerrain(float[] heightMap) 193 public override void SetTerrain(float[] heightMap)
194 { 194 {
195 this._heightMap = heightMap; 195 this._heightMap = heightMap;
196 } 196 }
197 197
198 public override void DeleteTerrain() 198 public override void DeleteTerrain()
199 { 199 {
200 200
201 } 201 }
202 } 202 }
203 203
204 public class BasicActor : PhysicsActor 204 public class BasicActor : PhysicsActor
205 { 205 {
206 private PhysicsVector _position; 206 private PhysicsVector _position;
207 private PhysicsVector _velocity; 207 private PhysicsVector _velocity;
208 private PhysicsVector _acceleration; 208 private PhysicsVector _acceleration;
209 private bool flying; 209 private bool flying;
210 public BasicActor() 210 public BasicActor()
211 { 211 {
212 _velocity = new PhysicsVector(); 212 _velocity = new PhysicsVector();
213 _position = new PhysicsVector(); 213 _position = new PhysicsVector();
214 _acceleration = new PhysicsVector(); 214 _acceleration = new PhysicsVector();
215 } 215 }
216 216
217 public override bool Flying 217 public override bool Flying
218 { 218 {
219 get 219 get
220 { 220 {
221 return flying; 221 return flying;
222 } 222 }
223 set 223 set
224 { 224 {
225 flying= value; 225 flying= value;
226 } 226 }
227 } 227 }
228 228
229 public override PhysicsVector Position 229 public override PhysicsVector Position
230 { 230 {
231 get 231 get
232 { 232 {
233 return _position; 233 return _position;
234 } 234 }
235 set 235 set
236 { 236 {
237 _position = value; 237 _position = value;
238 } 238 }
239 } 239 }
240 240
241 public override PhysicsVector Velocity 241 public override PhysicsVector Velocity
242 { 242 {
243 get 243 get
244 { 244 {
245 return _velocity; 245 return _velocity;
246 } 246 }
247 set 247 set
248 { 248 {
249 _velocity = value; 249 _velocity = value;
250 } 250 }
251 } 251 }
252 252
253 public override Quaternion Orientation 253 public override Quaternion Orientation
254 { 254 {
255 get 255 get
256 { 256 {
257 return Quaternion.Identity; 257 return Quaternion.Identity;
258 } 258 }
259 set 259 set
260 { 260 {
261 261
262 } 262 }
263 } 263 }
264 264
265 public override PhysicsVector Acceleration 265 public override PhysicsVector Acceleration
266 { 266 {
267 get 267 get
268 { 268 {
269 return _acceleration; 269 return _acceleration;
270 } 270 }
271 271
272 } 272 }
273 273
274 public override bool Kinematic 274 public override bool Kinematic
275 { 275 {
276 get 276 get
277 { 277 {
278 return true; 278 return true;
279 } 279 }
280 set 280 set
281 { 281 {
282 282
283 } 283 }
284 } 284 }
285 public void SetAcceleration (PhysicsVector accel) 285 public void SetAcceleration (PhysicsVector accel)
286 { 286 {
287 this._acceleration = accel; 287 this._acceleration = accel;
288 } 288 }
289 289
290 public override void AddForce(PhysicsVector force) 290 public override void AddForce(PhysicsVector force)
291 { 291 {
292 292
293 } 293 }
294 294
295 public override void SetMomentum(PhysicsVector momentum) 295 public override void SetMomentum(PhysicsVector momentum)
296 { 296 {
297 297
298 } 298 }
299 } 299 }
300 300
301} 301}
diff --git a/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs
index bda35f7..42ccdff 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs
@@ -1,56 +1,56 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following 30// Information about this assembly is defined by the following
31// attributes. 31// attributes.
32// 32//
33// change them to the information which is associated with the assembly 33// change them to the information which is associated with the assembly
34// you compile. 34// you compile.
35 35
36[assembly: AssemblyTitle("BulletXPlugin")] 36[assembly: AssemblyTitle("BulletXPlugin")]
37[assembly: AssemblyDescription("")] 37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 39[assembly: AssemblyCompany("")]
40[assembly: AssemblyProduct("BulletXPlugin")] 40[assembly: AssemblyProduct("BulletXPlugin")]
41[assembly: AssemblyCopyright("")] 41[assembly: AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 43[assembly: AssemblyCulture("")]
44 44
45// This sets the default COM visibility of types in the assembly to invisible. 45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 47[assembly: ComVisible(false)]
48 48
49// The assembly version has following format : 49// The assembly version has following format :
50// 50//
51// Major.Minor.Build.Revision 51// Major.Minor.Build.Revision
52// 52//
53// You can specify all values by your own or you can build default build and revision 53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 54// numbers with the '*' character (the default):
55 55
56[assembly: AssemblyVersion("1.0.0.0")] 56[assembly: AssemblyVersion("1.0.0.0")]
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index 1ca5efe..383dbc0 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
@@ -1,534 +1,534 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28#region References 28#region References
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using OpenSim.Physics.Manager; 31using OpenSim.Physics.Manager;
32using Axiom.Math; 32using Axiom.Math;
33//Specific References for BulletXPlugin 33//Specific References for BulletXPlugin
34using MonoXnaCompactMaths; 34using MonoXnaCompactMaths;
35using XnaDevRu.BulletX; 35using XnaDevRu.BulletX;
36using XnaDevRu.BulletX.Dynamics; 36using XnaDevRu.BulletX.Dynamics;
37#endregion 37#endregion
38 38
39namespace OpenSim.Region.Physics.BulletXPlugin 39namespace OpenSim.Region.Physics.BulletXPlugin
40{ 40{
41 /// <summary> 41 /// <summary>
42 /// This Class converts objects and types for BulletX 42 /// This Class converts objects and types for BulletX
43 /// </summary> 43 /// </summary>
44 public class BulletXConversions 44 public class BulletXConversions
45 { 45 {
46 public static MonoXnaCompactMaths.Vector3 PhysicsVectorToXnaVector3(PhysicsVector physicsVector) 46 public static MonoXnaCompactMaths.Vector3 PhysicsVectorToXnaVector3(PhysicsVector physicsVector)
47 { 47 {
48 return new MonoXnaCompactMaths.Vector3(physicsVector.X, physicsVector.Y, physicsVector.Z); 48 return new MonoXnaCompactMaths.Vector3(physicsVector.X, physicsVector.Y, physicsVector.Z);
49 } 49 }
50 public static void PhysicsVectorToXnaVector3(PhysicsVector physicsVector, out MonoXnaCompactMaths.Vector3 XnaVector3) 50 public static void PhysicsVectorToXnaVector3(PhysicsVector physicsVector, out MonoXnaCompactMaths.Vector3 XnaVector3)
51 { 51 {
52 XnaVector3.X = physicsVector.X; 52 XnaVector3.X = physicsVector.X;
53 XnaVector3.Y = physicsVector.Y; 53 XnaVector3.Y = physicsVector.Y;
54 XnaVector3.Z = physicsVector.Z; 54 XnaVector3.Z = physicsVector.Z;
55 } 55 }
56 public static PhysicsVector XnaVector3ToPhysicsVector(MonoXnaCompactMaths.Vector3 xnaVector3) 56 public static PhysicsVector XnaVector3ToPhysicsVector(MonoXnaCompactMaths.Vector3 xnaVector3)
57 { 57 {
58 return new PhysicsVector(xnaVector3.X, xnaVector3.Y, xnaVector3.Z); 58 return new PhysicsVector(xnaVector3.X, xnaVector3.Y, xnaVector3.Z);
59 } 59 }
60 /*public static void XnaVector3ToPhysicsVector(MonoXnaCompactMaths.Vector3 xnaVector3, out PhysicsVector physicsVector) 60 /*public static void XnaVector3ToPhysicsVector(MonoXnaCompactMaths.Vector3 xnaVector3, out PhysicsVector physicsVector)
61 { 61 {
62 xnaVector3.X = physicsVector.X; 62 xnaVector3.X = physicsVector.X;
63 xnaVector3.Y = physicsVector.Y; 63 xnaVector3.Y = physicsVector.Y;
64 xnaVector3.Z = physicsVector.Z; 64 xnaVector3.Z = physicsVector.Z;
65 }*/ 65 }*/
66 #region Axiom and Xna 66 #region Axiom and Xna
67 ///// <summary> 67 ///// <summary>
68 ///// BTW maybe some conversions will be a simply converion that it doesn't require this class, but i don't know 68 ///// BTW maybe some conversions will be a simply converion that it doesn't require this class, but i don't know
69 ///// </summary> 69 ///// </summary>
70 ///// <param name="AxiomVector3"></param> 70 ///// <param name="AxiomVector3"></param>
71 ///// <returns></returns> 71 ///// <returns></returns>
72 //public static MonoXnaCompactMaths.Vector3 Vector3AxiomToXna(Axiom.Math.Vector3 AxiomVector3) 72 //public static MonoXnaCompactMaths.Vector3 Vector3AxiomToXna(Axiom.Math.Vector3 AxiomVector3)
73 //{ 73 //{
74 // return new MonoXnaCompactMaths.Vector3(AxiomVector3.x, AxiomVector3.y, AxiomVector3.z); 74 // return new MonoXnaCompactMaths.Vector3(AxiomVector3.x, AxiomVector3.y, AxiomVector3.z);
75 //} 75 //}
76 #endregion 76 #endregion
77 } 77 }
78 /// <summary> 78 /// <summary>
79 /// PhysicsPlugin Class for BulletX 79 /// PhysicsPlugin Class for BulletX
80 /// </summary> 80 /// </summary>
81 public class BulletXPlugin : IPhysicsPlugin 81 public class BulletXPlugin : IPhysicsPlugin
82 { 82 {
83 private BulletXScene _mScene; 83 private BulletXScene _mScene;
84 84
85 public BulletXPlugin() 85 public BulletXPlugin()
86 { 86 {
87 } 87 }
88 public bool Init() 88 public bool Init()
89 { 89 {
90 return true; 90 return true;
91 } 91 }
92 public PhysicsScene GetScene() 92 public PhysicsScene GetScene()
93 { 93 {
94 if (_mScene == null) 94 if (_mScene == null)
95 { 95 {
96 _mScene = new BulletXScene(); 96 _mScene = new BulletXScene();
97 } 97 }
98 return (_mScene); 98 return (_mScene);
99 } 99 }
100 public string GetName() 100 public string GetName()
101 { 101 {
102 return ("BulletXEngine"); 102 return ("BulletXEngine");
103 } 103 }
104 public void Dispose() 104 public void Dispose()
105 { 105 {
106 } 106 }
107 } 107 }
108 /// <summary> 108 /// <summary>
109 /// PhysicsScene Class for BulletX 109 /// PhysicsScene Class for BulletX
110 /// </summary> 110 /// </summary>
111 public class BulletXScene : PhysicsScene 111 public class BulletXScene : PhysicsScene
112 { 112 {
113 public DiscreteDynamicsWorld ddWorld; 113 public DiscreteDynamicsWorld ddWorld;
114 private CollisionDispatcher cDispatcher; 114 private CollisionDispatcher cDispatcher;
115 private OverlappingPairCache opCache; 115 private OverlappingPairCache opCache;
116 private SequentialImpulseConstraintSolver sicSolver; 116 private SequentialImpulseConstraintSolver sicSolver;
117 117
118 private const int minXY = 0; 118 private const int minXY = 0;
119 private const int minZ = 0; 119 private const int minZ = 0;
120 private const int maxXY = 256; 120 private const int maxXY = 256;
121 private const int maxZ = 4096; 121 private const int maxZ = 4096;
122 private const int maxHandles = 32766; //Why? I don't know 122 private const int maxHandles = 32766; //Why? I don't know
123 private static float gravity = 9.8f; 123 private static float gravity = 9.8f;
124 private static float heightLevel0 = 77.0f; 124 private static float heightLevel0 = 77.0f;
125 private static float heightLevel1 = 200.0f; 125 private static float heightLevel1 = 200.0f;
126 private static float lowGravityFactor = 0.2f; 126 private static float lowGravityFactor = 0.2f;
127 127
128 private float[] _heightmap; 128 private float[] _heightmap;
129 private List<BulletXCharacter> _characters = new List<BulletXCharacter>(); 129 private List<BulletXCharacter> _characters = new List<BulletXCharacter>();
130 130
131 public static float Gravity { get { return gravity; } } 131 public static float Gravity { get { return gravity; } }
132 public static float HeightLevel0 { get { return heightLevel0; } } 132 public static float HeightLevel0 { get { return heightLevel0; } }
133 public static float HeightLevel1 { get { return heightLevel1; } } 133 public static float HeightLevel1 { get { return heightLevel1; } }
134 public static float LowGravityFactor { get { return lowGravityFactor; } } 134 public static float LowGravityFactor { get { return lowGravityFactor; } }
135 135
136 public BulletXScene() 136 public BulletXScene()
137 { 137 {
138 cDispatcher = new CollisionDispatcher(); 138 cDispatcher = new CollisionDispatcher();
139 MonoXnaCompactMaths.Vector3 worldMinDim = new MonoXnaCompactMaths.Vector3((float)minXY, (float)minXY, (float)minZ); 139 MonoXnaCompactMaths.Vector3 worldMinDim = new MonoXnaCompactMaths.Vector3((float)minXY, (float)minXY, (float)minZ);
140 MonoXnaCompactMaths.Vector3 worldMaxDim = new MonoXnaCompactMaths.Vector3((float)maxXY, (float)maxXY, (float)maxZ); 140 MonoXnaCompactMaths.Vector3 worldMaxDim = new MonoXnaCompactMaths.Vector3((float)maxXY, (float)maxXY, (float)maxZ);
141 opCache = new AxisSweep3(worldMinDim, worldMaxDim, maxHandles); 141 opCache = new AxisSweep3(worldMinDim, worldMaxDim, maxHandles);
142 sicSolver = new SequentialImpulseConstraintSolver(); 142 sicSolver = new SequentialImpulseConstraintSolver();
143 143
144 ddWorld = new DiscreteDynamicsWorld(cDispatcher, opCache, sicSolver); 144 ddWorld = new DiscreteDynamicsWorld(cDispatcher, opCache, sicSolver);
145 ddWorld.Gravity = new MonoXnaCompactMaths.Vector3(0, 0, -gravity); 145 ddWorld.Gravity = new MonoXnaCompactMaths.Vector3(0, 0, -gravity);
146 146
147 this._heightmap = new float[65536]; 147 this._heightmap = new float[65536];
148 } 148 }
149 149
150 public override PhysicsActor AddAvatar(PhysicsVector position) 150 public override PhysicsActor AddAvatar(PhysicsVector position)
151 { 151 {
152 PhysicsVector pos = new PhysicsVector(); 152 PhysicsVector pos = new PhysicsVector();
153 pos.X = position.X; 153 pos.X = position.X;
154 pos.Y = position.Y; 154 pos.Y = position.Y;
155 pos.Z = position.Z + 20; 155 pos.Z = position.Z + 20;
156 BulletXCharacter newAv = new BulletXCharacter(this, pos); 156 BulletXCharacter newAv = new BulletXCharacter(this, pos);
157 this._characters.Add(newAv); 157 this._characters.Add(newAv);
158 return newAv; 158 return newAv;
159 } 159 }
160 160
161 public override void RemoveAvatar(PhysicsActor actor) 161 public override void RemoveAvatar(PhysicsActor actor)
162 { 162 {
163 163
164 } 164 }
165 165
166 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) 166 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size)
167 { 167 {
168 PhysicsVector pos = new PhysicsVector(); 168 PhysicsVector pos = new PhysicsVector();
169 pos.X = position.X; 169 pos.X = position.X;
170 pos.Y = position.Y; 170 pos.Y = position.Y;
171 pos.Z = position.Z; 171 pos.Z = position.Z;
172 PhysicsVector siz = new PhysicsVector(); 172 PhysicsVector siz = new PhysicsVector();
173 siz.X = size.X; 173 siz.X = size.X;
174 siz.Y = size.Y; 174 siz.Y = size.Y;
175 siz.Z = size.Z; 175 siz.Z = size.Z;
176 return new BulletXPrim(); 176 return new BulletXPrim();
177 } 177 }
178 178
179 public override void Simulate(float timeStep) 179 public override void Simulate(float timeStep)
180 { 180 {
181 foreach (BulletXCharacter actor in _characters) 181 foreach (BulletXCharacter actor in _characters)
182 { 182 {
183 actor.Move(timeStep); 183 actor.Move(timeStep);
184 184
185 } 185 }
186 ddWorld.StepSimulation(timeStep, 0, timeStep); 186 ddWorld.StepSimulation(timeStep, 0, timeStep);
187 foreach (BulletXCharacter actor in _characters) 187 foreach (BulletXCharacter actor in _characters)
188 { 188 {
189 actor.ValidateHeight(this._heightmap[ 189 actor.ValidateHeight(this._heightmap[
190 (int)Math.Round(actor.RigidBodyHorizontalPosition.x) * 256 190 (int)Math.Round(actor.RigidBodyHorizontalPosition.x) * 256
191 + (int)Math.Round(actor.RigidBodyHorizontalPosition.y)]); 191 + (int)Math.Round(actor.RigidBodyHorizontalPosition.y)]);
192 } 192 }
193 foreach (BulletXCharacter actor in _characters) 193 foreach (BulletXCharacter actor in _characters)
194 { 194 {
195 actor.UpdatePosition(); 195 actor.UpdatePosition();
196 } 196 }
197 197
198 } 198 }
199 199
200 public override void GetResults() 200 public override void GetResults()
201 { 201 {
202 202
203 } 203 }
204 204
205 public override bool IsThreaded 205 public override bool IsThreaded
206 { 206 {
207 get 207 get
208 { 208 {
209 return (false); // for now we won't be multithreaded 209 return (false); // for now we won't be multithreaded
210 } 210 }
211 } 211 }
212 212
213 public override void SetTerrain(float[] heightMap) 213 public override void SetTerrain(float[] heightMap)
214 { 214 {
215 //As the same as ODE, heightmap (x,y) must be swapped for BulletX 215 //As the same as ODE, heightmap (x,y) must be swapped for BulletX
216 for (int i = 0; i < 65536; i++) 216 for (int i = 0; i < 65536; i++)
217 { 217 {
218 // this._heightmap[i] = (double)heightMap[i]; 218 // this._heightmap[i] = (double)heightMap[i];
219 // dbm (danx0r) -- heightmap x,y must be swapped for Ode (should fix ODE, but for now...) 219 // dbm (danx0r) -- heightmap x,y must be swapped for Ode (should fix ODE, but for now...)
220 int x = i & 0xff; 220 int x = i & 0xff;
221 int y = i >> 8; 221 int y = i >> 8;
222 this._heightmap[i] = heightMap[x * 256 + y]; 222 this._heightmap[i] = heightMap[x * 256 + y];
223 } 223 }
224 } 224 }
225 225
226 public override void DeleteTerrain() 226 public override void DeleteTerrain()
227 { 227 {
228 228
229 } 229 }
230 } 230 }
231 /// <summary> 231 /// <summary>
232 /// PhysicsActor Character Class for BulletX 232 /// PhysicsActor Character Class for BulletX
233 /// </summary> 233 /// </summary>
234 public class BulletXCharacter : PhysicsActor 234 public class BulletXCharacter : PhysicsActor
235 { 235 {
236 private PhysicsVector _position; 236 private PhysicsVector _position;
237 private PhysicsVector _velocity; 237 private PhysicsVector _velocity;
238 private PhysicsVector _acceleration; 238 private PhysicsVector _acceleration;
239 private bool flying; 239 private bool flying;
240 private RigidBody rigidBody; 240 private RigidBody rigidBody;
241 public Axiom.Math.Vector2 RigidBodyHorizontalPosition 241 public Axiom.Math.Vector2 RigidBodyHorizontalPosition
242 { 242 {
243 get 243 get
244 { 244 {
245 return new Axiom.Math.Vector2(this.rigidBody.CenterOfMassPosition.X, this.rigidBody.CenterOfMassPosition.Y); 245 return new Axiom.Math.Vector2(this.rigidBody.CenterOfMassPosition.X, this.rigidBody.CenterOfMassPosition.Y);
246 } 246 }
247 } 247 }
248 public BulletXCharacter(BulletXScene parent_scene, PhysicsVector pos) 248 public BulletXCharacter(BulletXScene parent_scene, PhysicsVector pos)
249 { 249 {
250 _velocity = new PhysicsVector(); 250 _velocity = new PhysicsVector();
251 _position = pos; 251 _position = pos;
252 _acceleration = new PhysicsVector(); 252 _acceleration = new PhysicsVector();
253 float _mass = 50.0f; //This depends of avatar's dimensions 253 float _mass = 50.0f; //This depends of avatar's dimensions
254 Matrix _startTransform = Matrix.Identity; 254 Matrix _startTransform = Matrix.Identity;
255 _startTransform.Translation = BulletXConversions.PhysicsVectorToXnaVector3(pos); 255 _startTransform.Translation = BulletXConversions.PhysicsVectorToXnaVector3(pos);
256 Matrix _centerOfMassOffset = Matrix.Identity; 256 Matrix _centerOfMassOffset = Matrix.Identity;
257 CollisionShape _collisionShape = new BoxShape(new MonoXnaCompactMaths.Vector3(0.5f, 0.5f, 1.60f)); 257 CollisionShape _collisionShape = new BoxShape(new MonoXnaCompactMaths.Vector3(0.5f, 0.5f, 1.60f));
258 DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset); 258 DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset);
259 MonoXnaCompactMaths.Vector3 _localInertia = new MonoXnaCompactMaths.Vector3(); 259 MonoXnaCompactMaths.Vector3 _localInertia = new MonoXnaCompactMaths.Vector3();
260 _collisionShape.CalculateLocalInertia(_mass, out _localInertia); //Always when mass > 0 260 _collisionShape.CalculateLocalInertia(_mass, out _localInertia); //Always when mass > 0
261 261
262 //The next values might change 262 //The next values might change
263 float _linearDamping = 0.0f; 263 float _linearDamping = 0.0f;
264 float _angularDamping = 0.0f; 264 float _angularDamping = 0.0f;
265 float _friction = 0.5f; 265 float _friction = 0.5f;
266 float _restitution = 0.0f; 266 float _restitution = 0.0f;
267 267
268 rigidBody = new RigidBody(_mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping, _friction, _restitution); 268 rigidBody = new RigidBody(_mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping, _friction, _restitution);
269 rigidBody.ActivationState = ActivationState.DisableDeactivation; 269 rigidBody.ActivationState = ActivationState.DisableDeactivation;
270 270
271 parent_scene.ddWorld.AddRigidBody(rigidBody); 271 parent_scene.ddWorld.AddRigidBody(rigidBody);
272 } 272 }
273 273
274 public override bool Flying 274 public override bool Flying
275 { 275 {
276 get 276 get
277 { 277 {
278 return flying; 278 return flying;
279 } 279 }
280 set 280 set
281 { 281 {
282 flying = value; 282 flying = value;
283 } 283 }
284 } 284 }
285 285
286 public override PhysicsVector Position 286 public override PhysicsVector Position
287 { 287 {
288 get 288 get
289 { 289 {
290 return _position; 290 return _position;
291 } 291 }
292 set 292 set
293 { 293 {
294 _position = value; 294 _position = value;
295 } 295 }
296 } 296 }
297 297
298 public override PhysicsVector Velocity 298 public override PhysicsVector Velocity
299 { 299 {
300 get 300 get
301 { 301 {
302 return _velocity; 302 return _velocity;
303 } 303 }
304 set 304 set
305 { 305 {
306 _velocity = value; 306 _velocity = value;
307 } 307 }
308 } 308 }
309 309
310 public override bool Kinematic 310 public override bool Kinematic
311 { 311 {
312 get 312 get
313 { 313 {
314 return false; 314 return false;
315 } 315 }
316 set 316 set
317 { 317 {
318 318
319 } 319 }
320 } 320 }
321 321
322 public override Axiom.Math.Quaternion Orientation 322 public override Axiom.Math.Quaternion Orientation
323 { 323 {
324 get 324 get
325 { 325 {
326 return Axiom.Math.Quaternion.Identity; 326 return Axiom.Math.Quaternion.Identity;
327 } 327 }
328 set 328 set
329 { 329 {
330 330
331 } 331 }
332 } 332 }
333 333
334 public override PhysicsVector Acceleration 334 public override PhysicsVector Acceleration
335 { 335 {
336 get 336 get
337 { 337 {
338 return _acceleration; 338 return _acceleration;
339 } 339 }
340 340
341 } 341 }
342 public void SetAcceleration(PhysicsVector accel) 342 public void SetAcceleration(PhysicsVector accel)
343 { 343 {
344 this._acceleration = accel; 344 this._acceleration = accel;
345 } 345 }
346 346
347 public override void AddForce(PhysicsVector force) 347 public override void AddForce(PhysicsVector force)
348 { 348 {
349 349
350 } 350 }
351 351
352 public override void SetMomentum(PhysicsVector momentum) 352 public override void SetMomentum(PhysicsVector momentum)
353 { 353 {
354 354
355 } 355 }
356 356
357 public void Move(float timeStep) 357 public void Move(float timeStep)
358 { 358 {
359 MonoXnaCompactMaths.Vector3 vec = new MonoXnaCompactMaths.Vector3(); 359 MonoXnaCompactMaths.Vector3 vec = new MonoXnaCompactMaths.Vector3();
360 //if (this._velocity.X == 0.0f) 360 //if (this._velocity.X == 0.0f)
361 // vec.X = this.rigidBody.LinearVelocity.X; //current velocity 361 // vec.X = this.rigidBody.LinearVelocity.X; //current velocity
362 //else 362 //else
363 vec.X = this._velocity.X; //overrides current velocity 363 vec.X = this._velocity.X; //overrides current velocity
364 364
365 //if (this._velocity.Y == 0.0f) 365 //if (this._velocity.Y == 0.0f)
366 // vec.Y = this.rigidBody.LinearVelocity.Y; //current velocity 366 // vec.Y = this.rigidBody.LinearVelocity.Y; //current velocity
367 //else 367 //else
368 vec.Y = this._velocity.Y; //overrides current velocity 368 vec.Y = this._velocity.Y; //overrides current velocity
369 369
370 float nextZVelocity; 370 float nextZVelocity;
371 //if (this._velocity.Z == 0.0f) 371 //if (this._velocity.Z == 0.0f)
372 // nextZVelocity = this.rigidBody.LinearVelocity.Z; //current velocity 372 // nextZVelocity = this.rigidBody.LinearVelocity.Z; //current velocity
373 //else 373 //else
374 nextZVelocity = this._velocity.Z; //overrides current velocity 374 nextZVelocity = this._velocity.Z; //overrides current velocity
375 375
376 if (flying) 376 if (flying)
377 { 377 {
378 //Antigravity with movement 378 //Antigravity with movement
379 if (this._position.Z <= BulletXScene.HeightLevel0) 379 if (this._position.Z <= BulletXScene.HeightLevel0)
380 { 380 {
381 vec.Z = nextZVelocity + BulletXScene.Gravity * timeStep; 381 vec.Z = nextZVelocity + BulletXScene.Gravity * timeStep;
382 } 382 }
383 //Lowgravity with movement 383 //Lowgravity with movement
384 else if((this._position.Z > BulletXScene.HeightLevel0) 384 else if((this._position.Z > BulletXScene.HeightLevel0)
385 && (this._position.Z <= BulletXScene.HeightLevel1)) 385 && (this._position.Z <= BulletXScene.HeightLevel1))
386 { 386 {
387 vec.Z = nextZVelocity + BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor); 387 vec.Z = nextZVelocity + BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor);
388 } 388 }
389 //Lowgravity with... 389 //Lowgravity with...
390 else if (this._position.Z > BulletXScene.HeightLevel1) 390 else if (this._position.Z > BulletXScene.HeightLevel1)
391 { 391 {
392 if(nextZVelocity > 0) //no movement 392 if(nextZVelocity > 0) //no movement
393 vec.Z = BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor); 393 vec.Z = BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor);
394 else 394 else
395 vec.Z = nextZVelocity + BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor); 395 vec.Z = nextZVelocity + BulletXScene.Gravity * timeStep * (1.0f - BulletXScene.LowGravityFactor);
396 396
397 } 397 }
398 } 398 }
399 else 399 else
400 { 400 {
401 vec.Z = nextZVelocity; 401 vec.Z = nextZVelocity;
402 } 402 }
403 rigidBody.LinearVelocity = vec; 403 rigidBody.LinearVelocity = vec;
404 } 404 }
405 405
406 public void UpdatePosition() 406 public void UpdatePosition()
407 { 407 {
408 this._position = BulletXConversions.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition); 408 this._position = BulletXConversions.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition);
409 } 409 }
410 410
411 //This validation is very basic 411 //This validation is very basic
412 internal void ValidateHeight(float heighmapPositionValue) 412 internal void ValidateHeight(float heighmapPositionValue)
413 { 413 {
414 if (rigidBody.CenterOfMassPosition.Z < heighmapPositionValue) 414 if (rigidBody.CenterOfMassPosition.Z < heighmapPositionValue)
415 { 415 {
416 Matrix m = rigidBody.WorldTransform; 416 Matrix m = rigidBody.WorldTransform;
417 MonoXnaCompactMaths.Vector3 v3 = m.Translation; 417 MonoXnaCompactMaths.Vector3 v3 = m.Translation;
418 v3.Z = heighmapPositionValue; 418 v3.Z = heighmapPositionValue;
419 m.Translation = v3; 419 m.Translation = v3;
420 rigidBody.WorldTransform = m; 420 rigidBody.WorldTransform = m;
421 } 421 }
422 } 422 }
423 } 423 }
424 /// <summary> 424 /// <summary>
425 /// PhysicsActor Prim Class for BulletX 425 /// PhysicsActor Prim Class for BulletX
426 /// </summary> 426 /// </summary>
427 public class BulletXPrim : PhysicsActor 427 public class BulletXPrim : PhysicsActor
428 { 428 {
429 private PhysicsVector _position; 429 private PhysicsVector _position;
430 private PhysicsVector _velocity; 430 private PhysicsVector _velocity;
431 private PhysicsVector _acceleration; 431 private PhysicsVector _acceleration;
432 432
433 public BulletXPrim() 433 public BulletXPrim()
434 { 434 {
435 _velocity = new PhysicsVector(); 435 _velocity = new PhysicsVector();
436 _position = new PhysicsVector(); 436 _position = new PhysicsVector();
437 _acceleration = new PhysicsVector(); 437 _acceleration = new PhysicsVector();
438 } 438 }
439 public override bool Flying 439 public override bool Flying
440 { 440 {
441 get 441 get
442 { 442 {
443 return false; //no flying prims for you 443 return false; //no flying prims for you
444 } 444 }
445 set 445 set
446 { 446 {
447 447
448 } 448 }
449 } 449 }
450 public override PhysicsVector Position 450 public override PhysicsVector Position
451 { 451 {
452 get 452 get
453 { 453 {
454 PhysicsVector pos = new PhysicsVector(); 454 PhysicsVector pos = new PhysicsVector();
455 // PhysicsVector vec = this._prim.Position; 455 // PhysicsVector vec = this._prim.Position;
456 //pos.X = vec.X; 456 //pos.X = vec.X;
457 //pos.Y = vec.Y; 457 //pos.Y = vec.Y;
458 //pos.Z = vec.Z; 458 //pos.Z = vec.Z;
459 return pos; 459 return pos;
460 460
461 } 461 }
462 set 462 set
463 { 463 {
464 /*PhysicsVector vec = value; 464 /*PhysicsVector vec = value;
465 PhysicsVector pos = new PhysicsVector(); 465 PhysicsVector pos = new PhysicsVector();
466 pos.X = vec.X; 466 pos.X = vec.X;
467 pos.Y = vec.Y; 467 pos.Y = vec.Y;
468 pos.Z = vec.Z; 468 pos.Z = vec.Z;
469 this._prim.Position = pos;*/ 469 this._prim.Position = pos;*/
470 } 470 }
471 } 471 }
472 472
473 public override PhysicsVector Velocity 473 public override PhysicsVector Velocity
474 { 474 {
475 get 475 get
476 { 476 {
477 return _velocity; 477 return _velocity;
478 } 478 }
479 set 479 set
480 { 480 {
481 _velocity = value; 481 _velocity = value;
482 } 482 }
483 } 483 }
484 484
485 public override bool Kinematic 485 public override bool Kinematic
486 { 486 {
487 get 487 get
488 { 488 {
489 return false; 489 return false;
490 //return this._prim.Kinematic; 490 //return this._prim.Kinematic;
491 } 491 }
492 set 492 set
493 { 493 {
494 //this._prim.Kinematic = value; 494 //this._prim.Kinematic = value;
495 } 495 }
496 } 496 }
497 497
498 public override Axiom.Math.Quaternion Orientation 498 public override Axiom.Math.Quaternion Orientation
499 { 499 {
500 get 500 get
501 { 501 {
502 Axiom.Math.Quaternion res = new Axiom.Math.Quaternion(); 502 Axiom.Math.Quaternion res = new Axiom.Math.Quaternion();
503 return res; 503 return res;
504 } 504 }
505 set 505 set
506 { 506 {
507 507
508 } 508 }
509 } 509 }
510 510
511 public override PhysicsVector Acceleration 511 public override PhysicsVector Acceleration
512 { 512 {
513 get 513 get
514 { 514 {
515 return _acceleration; 515 return _acceleration;
516 } 516 }
517 517
518 } 518 }
519 public void SetAcceleration(PhysicsVector accel) 519 public void SetAcceleration(PhysicsVector accel)
520 { 520 {
521 this._acceleration = accel; 521 this._acceleration = accel;
522 } 522 }
523 523
524 public override void AddForce(PhysicsVector force) 524 public override void AddForce(PhysicsVector force)
525 { 525 {
526 526
527 } 527 }
528 528
529 public override void SetMomentum(PhysicsVector momentum) 529 public override void SetMomentum(PhysicsVector momentum)
530 { 530 {
531 531
532 } 532 }
533 } 533 }
534} 534}
diff --git a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs b/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
index 9415db9..27b467f 100644
--- a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
@@ -1,56 +1,56 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following 30// Information about this assembly is defined by the following
31// attributes. 31// attributes.
32// 32//
33// change them to the information which is associated with the assembly 33// change them to the information which is associated with the assembly
34// you compile. 34// you compile.
35 35
36[assembly: AssemblyTitle("PhysicsManager")] 36[assembly: AssemblyTitle("PhysicsManager")]
37[assembly: AssemblyDescription("")] 37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 39[assembly: AssemblyCompany("")]
40[assembly: AssemblyProduct("PhysicsManager")] 40[assembly: AssemblyProduct("PhysicsManager")]
41[assembly: AssemblyCopyright("")] 41[assembly: AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 43[assembly: AssemblyCulture("")]
44 44
45// This sets the default COM visibility of types in the assembly to invisible. 45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 47[assembly: ComVisible(false)]
48 48
49// The assembly version has following format : 49// The assembly version has following format :
50// 50//
51// Major.Minor.Build.Revision 51// Major.Minor.Build.Revision
52// 52//
53// You can specify all values by your own or you can build default build and revision 53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 54// numbers with the '*' character (the default):
55 55
56[assembly: AssemblyVersion("1.0.*")] 56[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index da3b560..2c2c8dd 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -1,167 +1,167 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using Axiom.Math; 28using Axiom.Math;
29 29
30namespace OpenSim.Physics.Manager 30namespace OpenSim.Physics.Manager
31{ 31{
32 public delegate void PositionUpdate(PhysicsVector position); 32 public delegate void PositionUpdate(PhysicsVector position);
33 public delegate void VelocityUpdate(PhysicsVector velocity); 33 public delegate void VelocityUpdate(PhysicsVector velocity);
34 public delegate void OrientationUpdate(Quaternion orientation); 34 public delegate void OrientationUpdate(Quaternion orientation);
35 35
36 public abstract class PhysicsActor 36 public abstract class PhysicsActor
37 { 37 {
38 public event PositionUpdate OnPositionUpdate; 38 public event PositionUpdate OnPositionUpdate;
39 public event VelocityUpdate OnVelocityUpdate; 39 public event VelocityUpdate OnVelocityUpdate;
40 public event OrientationUpdate OnOrientationUpdate; 40 public event OrientationUpdate OnOrientationUpdate;
41 41
42 public static PhysicsActor Null 42 public static PhysicsActor Null
43 { 43 {
44 get 44 get
45 { 45 {
46 return new NullPhysicsActor(); 46 return new NullPhysicsActor();
47 } 47 }
48 } 48 }
49 49
50 public abstract PhysicsVector Position 50 public abstract PhysicsVector Position
51 { 51 {
52 get; 52 get;
53 set; 53 set;
54 } 54 }
55 55
56 public abstract PhysicsVector Velocity 56 public abstract PhysicsVector Velocity
57 { 57 {
58 get; 58 get;
59 set; 59 set;
60 } 60 }
61 61
62 public abstract PhysicsVector Acceleration 62 public abstract PhysicsVector Acceleration
63 { 63 {
64 get; 64 get;
65 } 65 }
66 66
67 public abstract Quaternion Orientation 67 public abstract Quaternion Orientation
68 { 68 {
69 get; 69 get;
70 set; 70 set;
71 } 71 }
72 72
73 public abstract bool Flying 73 public abstract bool Flying
74 { 74 {
75 get; 75 get;
76 set; 76 set;
77 } 77 }
78 78
79 public abstract bool Kinematic 79 public abstract bool Kinematic
80 { 80 {
81 get; 81 get;
82 set; 82 set;
83 } 83 }
84 84
85 public abstract void AddForce(PhysicsVector force); 85 public abstract void AddForce(PhysicsVector force);
86 86
87 public abstract void SetMomentum(PhysicsVector momentum); 87 public abstract void SetMomentum(PhysicsVector momentum);
88 } 88 }
89 89
90 public class NullPhysicsActor : PhysicsActor 90 public class NullPhysicsActor : PhysicsActor
91 { 91 {
92 public override PhysicsVector Position 92 public override PhysicsVector Position
93 { 93 {
94 get 94 get
95 { 95 {
96 return PhysicsVector.Zero; 96 return PhysicsVector.Zero;
97 } 97 }
98 set 98 set
99 { 99 {
100 return; 100 return;
101 } 101 }
102 } 102 }
103 103
104 public override PhysicsVector Velocity 104 public override PhysicsVector Velocity
105 { 105 {
106 get 106 get
107 { 107 {
108 return PhysicsVector.Zero; 108 return PhysicsVector.Zero;
109 } 109 }
110 set 110 set
111 { 111 {
112 return; 112 return;
113 } 113 }
114 } 114 }
115 115
116 public override Quaternion Orientation 116 public override Quaternion Orientation
117 { 117 {
118 get 118 get
119 { 119 {
120 return Quaternion.Identity; 120 return Quaternion.Identity;
121 } 121 }
122 set 122 set
123 { 123 {
124 124
125 } 125 }
126 } 126 }
127 127
128 public override PhysicsVector Acceleration 128 public override PhysicsVector Acceleration
129 { 129 {
130 get { return PhysicsVector.Zero; } 130 get { return PhysicsVector.Zero; }
131 } 131 }
132 132
133 public override bool Flying 133 public override bool Flying
134 { 134 {
135 get 135 get
136 { 136 {
137 return false; 137 return false;
138 } 138 }
139 set 139 set
140 { 140 {
141 return; 141 return;
142 } 142 }
143 } 143 }
144 144
145 public override bool Kinematic 145 public override bool Kinematic
146 { 146 {
147 get 147 get
148 { 148 {
149 return true; 149 return true;
150 } 150 }
151 set 151 set
152 { 152 {
153 return; 153 return;
154 } 154 }
155 } 155 }
156 156
157 public override void AddForce(PhysicsVector force) 157 public override void AddForce(PhysicsVector force)
158 { 158 {
159 return; 159 return;
160 } 160 }
161 161
162 public override void SetMomentum(PhysicsVector momentum) 162 public override void SetMomentum(PhysicsVector momentum)
163 { 163 {
164 return; 164 return;
165 } 165 }
166 } 166 }
167} 167}
diff --git a/OpenSim/Region/Physics/Manager/PhysicsManager.cs b/OpenSim/Region/Physics/Manager/PhysicsManager.cs
index 265bce6..7c475e7 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsManager.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsManager.cs
@@ -1,115 +1,115 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
33 33
34namespace OpenSim.Physics.Manager 34namespace OpenSim.Physics.Manager
35{ 35{
36 /// <summary> 36 /// <summary>
37 /// Description of MyClass. 37 /// Description of MyClass.
38 /// </summary> 38 /// </summary>
39 public class PhysicsManager 39 public class PhysicsManager
40 { 40 {
41 private Dictionary<string, IPhysicsPlugin> _plugins=new Dictionary<string, IPhysicsPlugin>(); 41 private Dictionary<string, IPhysicsPlugin> _plugins=new Dictionary<string, IPhysicsPlugin>();
42 42
43 public PhysicsManager() 43 public PhysicsManager()
44 { 44 {
45 45
46 } 46 }
47 47
48 public PhysicsScene GetPhysicsScene(string engineName) 48 public PhysicsScene GetPhysicsScene(string engineName)
49 { 49 {
50 if (String.IsNullOrEmpty(engineName)) 50 if (String.IsNullOrEmpty(engineName))
51 { 51 {
52 return PhysicsScene.Null; 52 return PhysicsScene.Null;
53 } 53 }
54 54
55 if(_plugins.ContainsKey(engineName)) 55 if(_plugins.ContainsKey(engineName))
56 { 56 {
57 MainLog.Instance.WriteLine(LogPriority.LOW,"creating "+engineName); 57 MainLog.Instance.WriteLine(LogPriority.LOW,"creating "+engineName);
58 return _plugins[engineName].GetScene(); 58 return _plugins[engineName].GetScene();
59 } 59 }
60 else 60 else
61 { 61 {
62 MainLog.Instance.WriteLine(LogPriority.MEDIUM,"couldn't find physicsEngine: {0}",engineName); 62 MainLog.Instance.WriteLine(LogPriority.MEDIUM,"couldn't find physicsEngine: {0}",engineName);
63 throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}",engineName)); 63 throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}",engineName));
64 } 64 }
65 } 65 }
66 66
67 public void LoadPlugins() 67 public void LoadPlugins()
68 { 68 {
69 string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory ,"Physics"); 69 string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory ,"Physics");
70 string[] pluginFiles = Directory.GetFiles(path, "*.dll"); 70 string[] pluginFiles = Directory.GetFiles(path, "*.dll");
71 71
72 72
73 for(int i= 0; i<pluginFiles.Length; i++) 73 for(int i= 0; i<pluginFiles.Length; i++)
74 { 74 {
75 this.AddPlugin(pluginFiles[i]); 75 this.AddPlugin(pluginFiles[i]);
76 } 76 }
77 } 77 }
78 78
79 private void AddPlugin(string FileName) 79 private void AddPlugin(string FileName)
80 { 80 {
81 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 81 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
82 82
83 foreach (Type pluginType in pluginAssembly.GetTypes()) 83 foreach (Type pluginType in pluginAssembly.GetTypes())
84 { 84 {
85 if (pluginType.IsPublic) 85 if (pluginType.IsPublic)
86 { 86 {
87 if (!pluginType.IsAbstract) 87 if (!pluginType.IsAbstract)
88 { 88 {
89 Type typeInterface = pluginType.GetInterface("IPhysicsPlugin", true); 89 Type typeInterface = pluginType.GetInterface("IPhysicsPlugin", true);
90 90
91 if (typeInterface != null) 91 if (typeInterface != null)
92 { 92 {
93 IPhysicsPlugin plug = (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 93 IPhysicsPlugin plug = (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
94 plug.Init(); 94 plug.Init();
95 this._plugins.Add(plug.GetName(),plug); 95 this._plugins.Add(plug.GetName(),plug);
96 96
97 } 97 }
98 98
99 typeInterface = null; 99 typeInterface = null;
100 } 100 }
101 } 101 }
102 } 102 }
103 103
104 pluginAssembly = null; 104 pluginAssembly = null;
105 } 105 }
106 } 106 }
107 107
108 public interface IPhysicsPlugin 108 public interface IPhysicsPlugin
109 { 109 {
110 bool Init(); 110 bool Init();
111 PhysicsScene GetScene(); 111 PhysicsScene GetScene();
112 string GetName(); 112 string GetName();
113 void Dispose(); 113 void Dispose();
114 } 114 }
115} 115}
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index d44da00..fb6358a 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -1,110 +1,110 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using OpenSim.Framework.Console; 28using OpenSim.Framework.Console;
29 29
30namespace OpenSim.Physics.Manager 30namespace OpenSim.Physics.Manager
31{ 31{
32 public abstract class PhysicsScene 32 public abstract class PhysicsScene
33 { 33 {
34 public static PhysicsScene Null 34 public static PhysicsScene Null
35 { 35 {
36 get 36 get
37 { 37 {
38 return new NullPhysicsScene(); 38 return new NullPhysicsScene();
39 } 39 }
40 } 40 }
41 41
42 public abstract PhysicsActor AddAvatar(PhysicsVector position); 42 public abstract PhysicsActor AddAvatar(PhysicsVector position);
43 43
44 public abstract void RemoveAvatar(PhysicsActor actor); 44 public abstract void RemoveAvatar(PhysicsActor actor);
45 45
46 public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size); 46 public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size);
47 47
48 public abstract void Simulate(float timeStep); 48 public abstract void Simulate(float timeStep);
49 49
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 53
54 public abstract void DeleteTerrain(); 54 public abstract void DeleteTerrain();
55 55
56 public abstract bool IsThreaded 56 public abstract bool IsThreaded
57 { 57 {
58 get; 58 get;
59 } 59 }
60 60
61 private class NullPhysicsScene : PhysicsScene 61 private class NullPhysicsScene : PhysicsScene
62 { 62 {
63 private static int m_workIndicator; 63 private static int m_workIndicator;
64 64
65 public override PhysicsActor AddAvatar(PhysicsVector position) 65 public override PhysicsActor AddAvatar(PhysicsVector position)
66 { 66 {
67 MainLog.Instance.Verbose("NullPhysicsScene : AddAvatar({0})", position); 67 MainLog.Instance.Verbose("NullPhysicsScene : AddAvatar({0})", position);
68 return PhysicsActor.Null; 68 return PhysicsActor.Null;
69 } 69 }
70 70
71 public override void RemoveAvatar(PhysicsActor actor) 71 public override void RemoveAvatar(PhysicsActor actor)
72 { 72 {
73 73
74 } 74 }
75 75
76 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) 76 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size)
77 { 77 {
78 MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size); 78 MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size);
79 return PhysicsActor.Null; 79 return PhysicsActor.Null;
80 } 80 }
81 81
82 public override void Simulate(float timeStep) 82 public override void Simulate(float timeStep)
83 { 83 {
84 m_workIndicator = (m_workIndicator + 1) % 10; 84 m_workIndicator = (m_workIndicator + 1) % 10;
85 85
86 //OpenSim.Framework.Console.MainLog.Instance.SetStatus(m_workIndicator.ToString()); 86 //OpenSim.Framework.Console.MainLog.Instance.SetStatus(m_workIndicator.ToString());
87 } 87 }
88 88
89 public override void GetResults() 89 public override void GetResults()
90 { 90 {
91 MainLog.Instance.Verbose("NullPhysicsScene : GetResults()"); 91 MainLog.Instance.Verbose("NullPhysicsScene : GetResults()");
92 } 92 }
93 93
94 public override void SetTerrain(float[] heightMap) 94 public override void SetTerrain(float[] heightMap)
95 { 95 {
96 MainLog.Instance.Verbose("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length); 96 MainLog.Instance.Verbose("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length);
97 } 97 }
98 98
99 public override void DeleteTerrain() 99 public override void DeleteTerrain()
100 { 100 {
101 101
102 } 102 }
103 103
104 public override bool IsThreaded 104 public override bool IsThreaded
105 { 105 {
106 get { return false; } 106 get { return false; }
107 } 107 }
108 } 108 }
109 } 109 }
110} 110}
diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs
index e75f29b..2cbca25 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsVector.cs
@@ -1,55 +1,55 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28namespace OpenSim.Physics.Manager 28namespace OpenSim.Physics.Manager
29{ 29{
30 public class PhysicsVector 30 public class PhysicsVector
31 { 31 {
32 public float X; 32 public float X;
33 public float Y; 33 public float Y;
34 public float Z; 34 public float Z;
35 35
36 public PhysicsVector() 36 public PhysicsVector()
37 { 37 {
38 38
39 } 39 }
40 40
41 public PhysicsVector(float x, float y, float z) 41 public PhysicsVector(float x, float y, float z)
42 { 42 {
43 X = x; 43 X = x;
44 Y = y; 44 Y = y;
45 Z = z; 45 Z = z;
46 } 46 }
47 47
48 public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f); 48 public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f);
49 49
50 public override string ToString() 50 public override string ToString()
51 { 51 {
52 return "<" + this.X + "," + this.Y + "," + this.Z + ">"; 52 return "<" + this.X + "," + this.Y + "," + this.Z + ">";
53 } 53 }
54 } 54 }
55} 55}
diff --git a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs
index ee10430..662b75a 100644
--- a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs
@@ -1,56 +1,56 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following 30// Information about this assembly is defined by the following
31// attributes. 31// attributes.
32// 32//
33// change them to the information which is associated with the assembly 33// change them to the information which is associated with the assembly
34// you compile. 34// you compile.
35 35
36[assembly: AssemblyTitle("RealPhysXplugin")] 36[assembly: AssemblyTitle("RealPhysXplugin")]
37[assembly: AssemblyDescription("")] 37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 39[assembly: AssemblyCompany("")]
40[assembly: AssemblyProduct("RealPhysXplugin")] 40[assembly: AssemblyProduct("RealPhysXplugin")]
41[assembly: AssemblyCopyright("")] 41[assembly: AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 43[assembly: AssemblyCulture("")]
44 44
45// This sets the default COM visibility of types in the assembly to invisible. 45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 47[assembly: ComVisible(false)]
48 48
49// The assembly version has following format : 49// The assembly version has following format :
50// 50//
51// Major.Minor.Build.Revision 51// Major.Minor.Build.Revision
52// 52//
53// You can specify all values by your own or you can build default build and revision 53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 54// numbers with the '*' character (the default):
55 55
56[assembly: AssemblyVersion("1.0.*")] 56[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 2780188..486fa9e 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -1,457 +1,457 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using Axiom.Math; 30using Axiom.Math;
31using Ode.NET; 31using Ode.NET;
32using OpenSim.Physics.Manager; 32using OpenSim.Physics.Manager;
33 33
34namespace OpenSim.Region.Physics.OdePlugin 34namespace OpenSim.Region.Physics.OdePlugin
35{ 35{
36 /// <summary> 36 /// <summary>
37 /// ODE plugin 37 /// ODE plugin
38 /// </summary> 38 /// </summary>
39 public class OdePlugin : IPhysicsPlugin 39 public class OdePlugin : IPhysicsPlugin
40 { 40 {
41 private OdeScene _mScene; 41 private OdeScene _mScene;
42 42
43 public OdePlugin() 43 public OdePlugin()
44 { 44 {
45 45
46 } 46 }
47 47
48 public bool Init() 48 public bool Init()
49 { 49 {
50 return true; 50 return true;
51 } 51 }
52 52
53 public PhysicsScene GetScene() 53 public PhysicsScene GetScene()
54 { 54 {
55 if (_mScene == null) 55 if (_mScene == null)
56 { 56 {
57 _mScene = new OdeScene(); 57 _mScene = new OdeScene();
58 } 58 }
59 return (_mScene); 59 return (_mScene);
60 } 60 }
61 61
62 public string GetName() 62 public string GetName()
63 { 63 {
64 return ("OpenDynamicsEngine"); 64 return ("OpenDynamicsEngine");
65 } 65 }
66 66
67 public void Dispose() 67 public void Dispose()
68 { 68 {
69 69
70 } 70 }
71 } 71 }
72 72
73 public class OdeScene : PhysicsScene 73 public class OdeScene : PhysicsScene
74 { 74 {
75 static public IntPtr world; 75 static public IntPtr world;
76 static public IntPtr space; 76 static public IntPtr space;
77 static private IntPtr contactgroup; 77 static private IntPtr contactgroup;
78 static private IntPtr LandGeom; 78 static private IntPtr LandGeom;
79 //static private IntPtr Land; 79 //static private IntPtr Land;
80 private double[] _heightmap; 80 private double[] _heightmap;
81 static private d.NearCallback nearCallback = near; 81 static private d.NearCallback nearCallback = near;
82 private List<OdeCharacter> _characters = new List<OdeCharacter>(); 82 private List<OdeCharacter> _characters = new List<OdeCharacter>();
83 private static d.ContactGeom[] contacts = new d.ContactGeom[30]; 83 private static d.ContactGeom[] contacts = new d.ContactGeom[30];
84 private static d.Contact contact; 84 private static d.Contact contact;
85 85
86 public OdeScene() 86 public OdeScene()
87 { 87 {
88 contact.surface.mode = d.ContactFlags.Bounce | d.ContactFlags.SoftCFM; 88 contact.surface.mode = d.ContactFlags.Bounce | d.ContactFlags.SoftCFM;
89 contact.surface.mu = d.Infinity; 89 contact.surface.mu = d.Infinity;
90 contact.surface.mu2 = 0.0f; 90 contact.surface.mu2 = 0.0f;
91 contact.surface.bounce = 0.1f; 91 contact.surface.bounce = 0.1f;
92 contact.surface.bounce_vel = 0.1f; 92 contact.surface.bounce_vel = 0.1f;
93 contact.surface.soft_cfm = 0.01f; 93 contact.surface.soft_cfm = 0.01f;
94 94
95 world = d.WorldCreate(); 95 world = d.WorldCreate();
96 space = d.HashSpaceCreate(IntPtr.Zero); 96 space = d.HashSpaceCreate(IntPtr.Zero);
97 contactgroup = d.JointGroupCreate(0); 97 contactgroup = d.JointGroupCreate(0);
98 d.WorldSetGravity(world, 0.0f, 0.0f, -0.5f); 98 d.WorldSetGravity(world, 0.0f, 0.0f, -0.5f);
99 //d.WorldSetCFM(world, 1e-5f); 99 //d.WorldSetCFM(world, 1e-5f);
100 d.WorldSetAutoDisableFlag(world, false); 100 d.WorldSetAutoDisableFlag(world, false);
101 d.WorldSetContactSurfaceLayer(world, 0.001f); 101 d.WorldSetContactSurfaceLayer(world, 0.001f);
102 // d.CreatePlane(space, 0, 0, 1, 0); 102 // d.CreatePlane(space, 0, 0, 1, 0);
103 this._heightmap = new double[65536]; 103 this._heightmap = new double[65536];
104 } 104 }
105 105
106 // This function blatantly ripped off from BoxStack.cs 106 // This function blatantly ripped off from BoxStack.cs
107 static private void near(IntPtr space, IntPtr g1, IntPtr g2) 107 static private void near(IntPtr space, IntPtr g1, IntPtr g2)
108 { 108 {
109 IntPtr b1 = d.GeomGetBody(g1); 109 IntPtr b1 = d.GeomGetBody(g1);
110 IntPtr b2 = d.GeomGetBody(g2); 110 IntPtr b2 = d.GeomGetBody(g2);
111 if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) 111 if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
112 return; 112 return;
113 113
114 int count = d.Collide(g1, g2, 500, contacts, d.ContactGeom.SizeOf); 114 int count = d.Collide(g1, g2, 500, contacts, d.ContactGeom.SizeOf);
115 for (int i = 0; i < count; ++i) 115 for (int i = 0; i < count; ++i)
116 { 116 {
117 contact.geom = contacts[i]; 117 contact.geom = contacts[i];
118 IntPtr joint = d.JointCreateContact(world, contactgroup, ref contact); 118 IntPtr joint = d.JointCreateContact(world, contactgroup, ref contact);
119 d.JointAttach(joint, b1, b2); 119 d.JointAttach(joint, b1, b2);
120 } 120 }
121 121
122 } 122 }
123 123
124 public override PhysicsActor AddAvatar(PhysicsVector position) 124 public override PhysicsActor AddAvatar(PhysicsVector position)
125 { 125 {
126 PhysicsVector pos = new PhysicsVector(); 126 PhysicsVector pos = new PhysicsVector();
127 pos.X = position.X; 127 pos.X = position.X;
128 pos.Y = position.Y; 128 pos.Y = position.Y;
129 pos.Z = position.Z + 20; 129 pos.Z = position.Z + 20;
130 OdeCharacter newAv = new OdeCharacter(this, pos); 130 OdeCharacter newAv = new OdeCharacter(this, pos);
131 this._characters.Add(newAv); 131 this._characters.Add(newAv);
132 return newAv; 132 return newAv;
133 } 133 }
134 134
135 public override void RemoveAvatar(PhysicsActor actor) 135 public override void RemoveAvatar(PhysicsActor actor)
136 { 136 {
137 137
138 } 138 }
139 139
140 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) 140 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size)
141 { 141 {
142 PhysicsVector pos = new PhysicsVector(); 142 PhysicsVector pos = new PhysicsVector();
143 pos.X = position.X; 143 pos.X = position.X;
144 pos.Y = position.Y; 144 pos.Y = position.Y;
145 pos.Z = position.Z; 145 pos.Z = position.Z;
146 PhysicsVector siz = new PhysicsVector(); 146 PhysicsVector siz = new PhysicsVector();
147 siz.X = size.X; 147 siz.X = size.X;
148 siz.Y = size.Y; 148 siz.Y = size.Y;
149 siz.Z = size.Z; 149 siz.Z = size.Z;
150 return new OdePrim(); 150 return new OdePrim();
151 } 151 }
152 152
153 public override void Simulate(float timeStep) 153 public override void Simulate(float timeStep)
154 { 154 {
155 foreach (OdeCharacter actor in _characters) 155 foreach (OdeCharacter actor in _characters)
156 { 156 {
157 actor.Move(timeStep * 5f); 157 actor.Move(timeStep * 5f);
158 } 158 }
159 d.SpaceCollide(space, IntPtr.Zero, nearCallback); 159 d.SpaceCollide(space, IntPtr.Zero, nearCallback);
160 d.WorldQuickStep(world, timeStep * 5f); 160 d.WorldQuickStep(world, timeStep * 5f);
161 d.JointGroupEmpty(contactgroup); 161 d.JointGroupEmpty(contactgroup);
162 foreach (OdeCharacter actor in _characters) 162 foreach (OdeCharacter actor in _characters)
163 { 163 {
164 actor.UpdatePosition(); 164 actor.UpdatePosition();
165 } 165 }
166 166
167 } 167 }
168 168
169 public override void GetResults() 169 public override void GetResults()
170 { 170 {
171 171
172 } 172 }
173 173
174 public override bool IsThreaded 174 public override bool IsThreaded
175 { 175 {
176 get 176 get
177 { 177 {
178 return (false); // for now we won't be multithreaded 178 return (false); // for now we won't be multithreaded
179 } 179 }
180 } 180 }
181 181
182 public override void SetTerrain(float[] heightMap) 182 public override void SetTerrain(float[] heightMap)
183 { 183 {
184 for (int i = 0; i < 65536; i++) 184 for (int i = 0; i < 65536; i++)
185 { 185 {
186 // this._heightmap[i] = (double)heightMap[i]; 186 // this._heightmap[i] = (double)heightMap[i];
187 // dbm (danx0r) -- heightmap x,y must be swapped for Ode (should fix ODE, but for now...) 187 // dbm (danx0r) -- heightmap x,y must be swapped for Ode (should fix ODE, but for now...)
188 int x = i & 0xff; 188 int x = i & 0xff;
189 int y = i >> 8; 189 int y = i >> 8;
190 this._heightmap[i] = (double)heightMap[x * 256 + y]; 190 this._heightmap[i] = (double)heightMap[x * 256 + y];
191 } 191 }
192 IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); 192 IntPtr HeightmapData = d.GeomHeightfieldDataCreate();
193 d.GeomHeightfieldDataBuildDouble(HeightmapData, _heightmap, 0, 256, 256, 256, 256, 1.0f, 0.0f, 2.0f, 0); 193 d.GeomHeightfieldDataBuildDouble(HeightmapData, _heightmap, 0, 256, 256, 256, 256, 1.0f, 0.0f, 2.0f, 0);
194 d.GeomHeightfieldDataSetBounds(HeightmapData, 256, 256); 194 d.GeomHeightfieldDataSetBounds(HeightmapData, 256, 256);
195 LandGeom = d.CreateHeightfield(space, HeightmapData, 1); 195 LandGeom = d.CreateHeightfield(space, HeightmapData, 1);
196 d.Matrix3 R = new d.Matrix3(); 196 d.Matrix3 R = new d.Matrix3();
197 197
198 Quaternion q1 =Quaternion.FromAngleAxis(1.5707f, new Vector3(1,0,0)); 198 Quaternion q1 =Quaternion.FromAngleAxis(1.5707f, new Vector3(1,0,0));
199 Quaternion q2 =Quaternion.FromAngleAxis(1.5707f, new Vector3(0,1,0)); 199 Quaternion q2 =Quaternion.FromAngleAxis(1.5707f, new Vector3(0,1,0));
200 //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1)); 200 //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1));
201 201
202 q1 = q1 * q2; 202 q1 = q1 * q2;
203 //q1 = q1 * q3; 203 //q1 = q1 * q3;
204 Vector3 v3 = new Vector3(); 204 Vector3 v3 = new Vector3();
205 float angle = 0; 205 float angle = 0;
206 q1.ToAngleAxis(ref angle, ref v3); 206 q1.ToAngleAxis(ref angle, ref v3);
207 207
208 d.RFromAxisAndAngle(out R, v3.x, v3.y, v3.z, angle); 208 d.RFromAxisAndAngle(out R, v3.x, v3.y, v3.z, angle);
209 d.GeomSetRotation(LandGeom, ref R); 209 d.GeomSetRotation(LandGeom, ref R);
210 d.GeomSetPosition(LandGeom, 128, 128, 0); 210 d.GeomSetPosition(LandGeom, 128, 128, 0);
211 } 211 }
212 212
213 public override void DeleteTerrain() 213 public override void DeleteTerrain()
214 { 214 {
215 215
216 } 216 }
217 } 217 }
218 218
219 public class OdeCharacter : PhysicsActor 219 public class OdeCharacter : PhysicsActor
220 { 220 {
221 private PhysicsVector _position; 221 private PhysicsVector _position;
222 private PhysicsVector _velocity; 222 private PhysicsVector _velocity;
223 private PhysicsVector _acceleration; 223 private PhysicsVector _acceleration;
224 private bool flying; 224 private bool flying;
225 //private float gravityAccel; 225 //private float gravityAccel;
226 private IntPtr BoundingCapsule; 226 private IntPtr BoundingCapsule;
227 IntPtr capsule_geom; 227 IntPtr capsule_geom;
228 d.Mass capsule_mass; 228 d.Mass capsule_mass;
229 229
230 public OdeCharacter(OdeScene parent_scene, PhysicsVector pos) 230 public OdeCharacter(OdeScene parent_scene, PhysicsVector pos)
231 { 231 {
232 _velocity = new PhysicsVector(); 232 _velocity = new PhysicsVector();
233 _position = pos; 233 _position = pos;
234 _acceleration = new PhysicsVector(); 234 _acceleration = new PhysicsVector();
235 d.MassSetCapsule(out capsule_mass, 5.0f, 3, 0.5f, 2f); 235 d.MassSetCapsule(out capsule_mass, 5.0f, 3, 0.5f, 2f);
236 capsule_geom = d.CreateCapsule(OdeScene.space, 0.5f, 2f); 236 capsule_geom = d.CreateCapsule(OdeScene.space, 0.5f, 2f);
237 this.BoundingCapsule = d.BodyCreate(OdeScene.world); 237 this.BoundingCapsule = d.BodyCreate(OdeScene.world);
238 d.BodySetMass(BoundingCapsule, ref capsule_mass); 238 d.BodySetMass(BoundingCapsule, ref capsule_mass);
239 d.BodySetPosition(BoundingCapsule, pos.X, pos.Y, pos.Z); 239 d.BodySetPosition(BoundingCapsule, pos.X, pos.Y, pos.Z);
240 d.GeomSetBody(capsule_geom, BoundingCapsule); 240 d.GeomSetBody(capsule_geom, BoundingCapsule);
241 } 241 }
242 242
243 public override bool Flying 243 public override bool Flying
244 { 244 {
245 get 245 get
246 { 246 {
247 return flying; 247 return flying;
248 } 248 }
249 set 249 set
250 { 250 {
251 flying = value; 251 flying = value;
252 } 252 }
253 } 253 }
254 254
255 public override PhysicsVector Position 255 public override PhysicsVector Position
256 { 256 {
257 get 257 get
258 { 258 {
259 return _position; 259 return _position;
260 } 260 }
261 set 261 set
262 { 262 {
263 _position = value; 263 _position = value;
264 } 264 }
265 } 265 }
266 266
267 public override PhysicsVector Velocity 267 public override PhysicsVector Velocity
268 { 268 {
269 get 269 get
270 { 270 {
271 return _velocity; 271 return _velocity;
272 } 272 }
273 set 273 set
274 { 274 {
275 _velocity = value; 275 _velocity = value;
276 } 276 }
277 } 277 }
278 278
279 public override bool Kinematic 279 public override bool Kinematic
280 { 280 {
281 get 281 get
282 { 282 {
283 return false; 283 return false;
284 } 284 }
285 set 285 set
286 { 286 {
287 287
288 } 288 }
289 } 289 }
290 290
291 public override Quaternion Orientation 291 public override Quaternion Orientation
292 { 292 {
293 get 293 get
294 { 294 {
295 return Quaternion.Identity; 295 return Quaternion.Identity;
296 } 296 }
297 set 297 set
298 { 298 {
299 299
300 } 300 }
301 } 301 }
302 302
303 public override PhysicsVector Acceleration 303 public override PhysicsVector Acceleration
304 { 304 {
305 get 305 get
306 { 306 {
307 return _acceleration; 307 return _acceleration;
308 } 308 }
309 309
310 } 310 }
311 public void SetAcceleration(PhysicsVector accel) 311 public void SetAcceleration(PhysicsVector accel)
312 { 312 {
313 this._acceleration = accel; 313 this._acceleration = accel;
314 } 314 }
315 315
316 public override void AddForce(PhysicsVector force) 316 public override void AddForce(PhysicsVector force)
317 { 317 {
318 318
319 } 319 }
320 320
321 public override void SetMomentum(PhysicsVector momentum) 321 public override void SetMomentum(PhysicsVector momentum)
322 { 322 {
323 323
324 } 324 }
325 325
326 public void Move(float timeStep) 326 public void Move(float timeStep)
327 { 327 {
328 PhysicsVector vec = new PhysicsVector(); 328 PhysicsVector vec = new PhysicsVector();
329 vec.X = this._velocity.X * timeStep; 329 vec.X = this._velocity.X * timeStep;
330 vec.Y = this._velocity.Y * timeStep; 330 vec.Y = this._velocity.Y * timeStep;
331 if (flying) 331 if (flying)
332 { 332 {
333 vec.Z = (this._velocity.Z + 0.5f) * timeStep; 333 vec.Z = (this._velocity.Z + 0.5f) * timeStep;
334 } 334 }
335 d.BodySetLinearVel(this.BoundingCapsule, vec.X, vec.Y, vec.Z); 335 d.BodySetLinearVel(this.BoundingCapsule, vec.X, vec.Y, vec.Z);
336 } 336 }
337 337
338 public void UpdatePosition() 338 public void UpdatePosition()
339 { 339 {
340 d.Vector3 vec = d.BodyGetPosition(BoundingCapsule); 340 d.Vector3 vec = d.BodyGetPosition(BoundingCapsule);
341 this._position.X = vec.X; 341 this._position.X = vec.X;
342 this._position.Y = vec.Y; 342 this._position.Y = vec.Y;
343 this._position.Z = vec.Z+1.0f; 343 this._position.Z = vec.Z+1.0f;
344 } 344 }
345 } 345 }
346 346
347 public class OdePrim : PhysicsActor 347 public class OdePrim : PhysicsActor
348 { 348 {
349 private PhysicsVector _position; 349 private PhysicsVector _position;
350 private PhysicsVector _velocity; 350 private PhysicsVector _velocity;
351 private PhysicsVector _acceleration; 351 private PhysicsVector _acceleration;
352 352
353 public OdePrim() 353 public OdePrim()
354 { 354 {
355 _velocity = new PhysicsVector(); 355 _velocity = new PhysicsVector();
356 _position = new PhysicsVector(); 356 _position = new PhysicsVector();
357 _acceleration = new PhysicsVector(); 357 _acceleration = new PhysicsVector();
358 } 358 }
359 public override bool Flying 359 public override bool Flying
360 { 360 {
361 get 361 get
362 { 362 {
363 return false; //no flying prims for you 363 return false; //no flying prims for you
364 } 364 }
365 set 365 set
366 { 366 {
367 367
368 } 368 }
369 } 369 }
370 public override PhysicsVector Position 370 public override PhysicsVector Position
371 { 371 {
372 get 372 get
373 { 373 {
374 PhysicsVector pos = new PhysicsVector(); 374 PhysicsVector pos = new PhysicsVector();
375 // PhysicsVector vec = this._prim.Position; 375 // PhysicsVector vec = this._prim.Position;
376 //pos.X = vec.X; 376 //pos.X = vec.X;
377 //pos.Y = vec.Y; 377 //pos.Y = vec.Y;
378 //pos.Z = vec.Z; 378 //pos.Z = vec.Z;
379 return pos; 379 return pos;
380 380
381 } 381 }
382 set 382 set
383 { 383 {
384 /*PhysicsVector vec = value; 384 /*PhysicsVector vec = value;
385 PhysicsVector pos = new PhysicsVector(); 385 PhysicsVector pos = new PhysicsVector();
386 pos.X = vec.X; 386 pos.X = vec.X;
387 pos.Y = vec.Y; 387 pos.Y = vec.Y;
388 pos.Z = vec.Z; 388 pos.Z = vec.Z;
389 this._prim.Position = pos;*/ 389 this._prim.Position = pos;*/
390 } 390 }
391 } 391 }
392 392
393 public override PhysicsVector Velocity 393 public override PhysicsVector Velocity
394 { 394 {
395 get 395 get
396 { 396 {
397 return _velocity; 397 return _velocity;
398 } 398 }
399 set 399 set
400 { 400 {
401 _velocity = value; 401 _velocity = value;
402 } 402 }
403 } 403 }
404 404
405 public override bool Kinematic 405 public override bool Kinematic
406 { 406 {
407 get 407 get
408 { 408 {
409 return false; 409 return false;
410 //return this._prim.Kinematic; 410 //return this._prim.Kinematic;
411 } 411 }
412 set 412 set
413 { 413 {
414 //this._prim.Kinematic = value; 414 //this._prim.Kinematic = value;
415 } 415 }
416 } 416 }
417 417
418 public override Quaternion Orientation 418 public override Quaternion Orientation
419 { 419 {
420 get 420 get
421 { 421 {
422 Quaternion res = new Quaternion(); 422 Quaternion res = new Quaternion();
423 return res; 423 return res;
424 } 424 }
425 set 425 set
426 { 426 {
427 427
428 } 428 }
429 } 429 }
430 430
431 public override PhysicsVector Acceleration 431 public override PhysicsVector Acceleration
432 { 432 {
433 get 433 get
434 { 434 {
435 return _acceleration; 435 return _acceleration;
436 } 436 }
437 437
438 } 438 }
439 public void SetAcceleration(PhysicsVector accel) 439 public void SetAcceleration(PhysicsVector accel)
440 { 440 {
441 this._acceleration = accel; 441 this._acceleration = accel;
442 } 442 }
443 443
444 public override void AddForce(PhysicsVector force) 444 public override void AddForce(PhysicsVector force)
445 { 445 {
446 446
447 } 447 }
448 448
449 public override void SetMomentum(PhysicsVector momentum) 449 public override void SetMomentum(PhysicsVector momentum)
450 { 450 {
451 451
452 } 452 }
453 453
454 454
455 } 455 }
456 456
457} 457}
diff --git a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs
index ee10430..662b75a 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs
@@ -1,56 +1,56 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30// Information about this assembly is defined by the following 30// Information about this assembly is defined by the following
31// attributes. 31// attributes.
32// 32//
33// change them to the information which is associated with the assembly 33// change them to the information which is associated with the assembly
34// you compile. 34// you compile.
35 35
36[assembly: AssemblyTitle("RealPhysXplugin")] 36[assembly: AssemblyTitle("RealPhysXplugin")]
37[assembly: AssemblyDescription("")] 37[assembly: AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 38[assembly: AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 39[assembly: AssemblyCompany("")]
40[assembly: AssemblyProduct("RealPhysXplugin")] 40[assembly: AssemblyProduct("RealPhysXplugin")]
41[assembly: AssemblyCopyright("")] 41[assembly: AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 42[assembly: AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 43[assembly: AssemblyCulture("")]
44 44
45// This sets the default COM visibility of types in the assembly to invisible. 45// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 46// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 47[assembly: ComVisible(false)]
48 48
49// The assembly version has following format : 49// The assembly version has following format :
50// 50//
51// Major.Minor.Build.Revision 51// Major.Minor.Build.Revision
52// 52//
53// You can specify all values by your own or you can build default build and revision 53// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 54// numbers with the '*' character (the default):
55 55
56[assembly: AssemblyVersion("1.0.*")] 56[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
index 4c82549..111d436 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
@@ -1,425 +1,425 @@
1/*/* 1/*/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenSim.Physics.Manager; 30using OpenSim.Physics.Manager;
31using PhysXWrapper; 31using PhysXWrapper;
32using Quaternion=Axiom.Math.Quaternion; 32using Quaternion=Axiom.Math.Quaternion;
33 33
34namespace OpenSim.Region.Physics.PhysXPlugin 34namespace OpenSim.Region.Physics.PhysXPlugin
35{ 35{
36 /// <summary> 36 /// <summary>
37 /// Will be the PhysX plugin but for now will be a very basic physics engine 37 /// Will be the PhysX plugin but for now will be a very basic physics engine
38 /// </summary> 38 /// </summary>
39 public class PhysXPlugin : IPhysicsPlugin 39 public class PhysXPlugin : IPhysicsPlugin
40 { 40 {
41 private PhysXScene _mScene; 41 private PhysXScene _mScene;
42 42
43 public PhysXPlugin() 43 public PhysXPlugin()
44 { 44 {
45 45
46 } 46 }
47 47
48 public bool Init() 48 public bool Init()
49 { 49 {
50 return true; 50 return true;
51 } 51 }
52 52
53 public PhysicsScene GetScene() 53 public PhysicsScene GetScene()
54 { 54 {
55 if(_mScene == null) 55 if(_mScene == null)
56 { 56 {
57 _mScene = new PhysXScene(); 57 _mScene = new PhysXScene();
58 } 58 }
59 return(_mScene); 59 return(_mScene);
60 } 60 }
61 61
62 public string GetName() 62 public string GetName()
63 { 63 {
64 return("RealPhysX"); 64 return("RealPhysX");
65 } 65 }
66 66
67 public void Dispose() 67 public void Dispose()
68 { 68 {
69 69
70 } 70 }
71 } 71 }
72 72
73 public class PhysXScene :PhysicsScene 73 public class PhysXScene :PhysicsScene
74 { 74 {
75 private List<PhysXCharacter> _characters = new List<PhysXCharacter>(); 75 private List<PhysXCharacter> _characters = new List<PhysXCharacter>();
76 private List<PhysXPrim> _prims = new List<PhysXPrim>(); 76 private List<PhysXPrim> _prims = new List<PhysXPrim>();
77 private float[] _heightMap = null; 77 private float[] _heightMap = null;
78 private NxPhysicsSDK mySdk; 78 private NxPhysicsSDK mySdk;
79 private NxScene scene; 79 private NxScene scene;
80 80
81 public PhysXScene() 81 public PhysXScene()
82 { 82 {
83 mySdk = NxPhysicsSDK.CreateSDK(); 83 mySdk = NxPhysicsSDK.CreateSDK();
84 Console.WriteLine("Sdk created - now creating scene"); 84 Console.WriteLine("Sdk created - now creating scene");
85 scene = mySdk.CreateScene(); 85 scene = mySdk.CreateScene();
86 86
87 } 87 }
88 88
89 public override PhysicsActor AddAvatar(PhysicsVector position) 89 public override PhysicsActor AddAvatar(PhysicsVector position)
90 { 90 {
91 Vec3 pos = new Vec3(); 91 Vec3 pos = new Vec3();
92 pos.X = position.X; 92 pos.X = position.X;
93 pos.Y = position.Y; 93 pos.Y = position.Y;
94 pos.Z = position.Z; 94 pos.Z = position.Z;
95 PhysXCharacter act = new PhysXCharacter( scene.AddCharacter(pos)); 95 PhysXCharacter act = new PhysXCharacter( scene.AddCharacter(pos));
96 act.Position = position; 96 act.Position = position;
97 _characters.Add(act); 97 _characters.Add(act);
98 return act; 98 return act;
99 } 99 }
100 100
101 public override void RemoveAvatar(PhysicsActor actor) 101 public override void RemoveAvatar(PhysicsActor actor)
102 { 102 {
103 103
104 } 104 }
105 105
106 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) 106 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size)
107 { 107 {
108 Vec3 pos = new Vec3(); 108 Vec3 pos = new Vec3();
109 pos.X = position.X; 109 pos.X = position.X;
110 pos.Y = position.Y; 110 pos.Y = position.Y;
111 pos.Z = position.Z; 111 pos.Z = position.Z;
112 Vec3 siz = new Vec3(); 112 Vec3 siz = new Vec3();
113 siz.X = size.X; 113 siz.X = size.X;
114 siz.Y = size.Y; 114 siz.Y = size.Y;
115 siz.Z = size.Z; 115 siz.Z = size.Z;
116 PhysXPrim act = new PhysXPrim( scene.AddNewBox(pos, siz)); 116 PhysXPrim act = new PhysXPrim( scene.AddNewBox(pos, siz));
117 _prims.Add(act); 117 _prims.Add(act);
118 return act; 118 return act;
119 } 119 }
120 public override void Simulate(float timeStep) 120 public override void Simulate(float timeStep)
121 { 121 {
122 try 122 try
123 { 123 {
124 foreach (PhysXCharacter actor in _characters) 124 foreach (PhysXCharacter actor in _characters)
125 { 125 {
126 actor.Move(timeStep); 126 actor.Move(timeStep);
127 } 127 }
128 scene.Simulate(timeStep); 128 scene.Simulate(timeStep);
129 scene.FetchResults(); 129 scene.FetchResults();
130 scene.UpdateControllers(); 130 scene.UpdateControllers();
131 131
132 foreach (PhysXCharacter actor in _characters) 132 foreach (PhysXCharacter actor in _characters)
133 { 133 {
134 actor.UpdatePosition(); 134 actor.UpdatePosition();
135 } 135 }
136 } 136 }
137 catch (Exception e) 137 catch (Exception e)
138 { 138 {
139 Console.WriteLine(e.Message); 139 Console.WriteLine(e.Message);
140 } 140 }
141 141
142 } 142 }
143 143
144 public override void GetResults() 144 public override void GetResults()
145 { 145 {
146 146
147 } 147 }
148 148
149 public override bool IsThreaded 149 public override bool IsThreaded
150 { 150 {
151 get 151 get
152 { 152 {
153 return(false); // for now we won't be multithreaded 153 return(false); // for now we won't be multithreaded
154 } 154 }
155 } 155 }
156 156
157 public override void SetTerrain(float[] heightMap) 157 public override void SetTerrain(float[] heightMap)
158 { 158 {
159 if (this._heightMap != null) 159 if (this._heightMap != null)
160 { 160 {
161 Console.WriteLine("PhysX - deleting old terrain"); 161 Console.WriteLine("PhysX - deleting old terrain");
162 this.scene.DeleteTerrain(); 162 this.scene.DeleteTerrain();
163 } 163 }
164 this._heightMap = heightMap; 164 this._heightMap = heightMap;
165 this.scene.AddTerrain(heightMap); 165 this.scene.AddTerrain(heightMap);
166 } 166 }
167 167
168 public override void DeleteTerrain() 168 public override void DeleteTerrain()
169 { 169 {
170 this.scene.DeleteTerrain(); 170 this.scene.DeleteTerrain();
171 } 171 }
172 } 172 }
173 173
174 public class PhysXCharacter : PhysicsActor 174 public class PhysXCharacter : PhysicsActor
175 { 175 {
176 private PhysicsVector _position; 176 private PhysicsVector _position;
177 private PhysicsVector _velocity; 177 private PhysicsVector _velocity;
178 private PhysicsVector _acceleration; 178 private PhysicsVector _acceleration;
179 private NxCharacter _character; 179 private NxCharacter _character;
180 private bool flying; 180 private bool flying;
181 private float gravityAccel; 181 private float gravityAccel;
182 182
183 public PhysXCharacter(NxCharacter character) 183 public PhysXCharacter(NxCharacter character)
184 { 184 {
185 _velocity = new PhysicsVector(); 185 _velocity = new PhysicsVector();
186 _position = new PhysicsVector(); 186 _position = new PhysicsVector();
187 _acceleration = new PhysicsVector(); 187 _acceleration = new PhysicsVector();
188 _character = character; 188 _character = character;
189 } 189 }
190 190
191 public override bool Flying 191 public override bool Flying
192 { 192 {
193 get 193 get
194 { 194 {
195 return flying; 195 return flying;
196 } 196 }
197 set 197 set
198 { 198 {
199 flying = value; 199 flying = value;
200 } 200 }
201 } 201 }
202 202
203 public override PhysicsVector Position 203 public override PhysicsVector Position
204 { 204 {
205 get 205 get
206 { 206 {
207 return _position; 207 return _position;
208 } 208 }
209 set 209 set
210 { 210 {
211 _position = value; 211 _position = value;
212 Vec3 ps = new Vec3(); 212 Vec3 ps = new Vec3();
213 ps.X = value.X; 213 ps.X = value.X;
214 ps.Y = value.Y; 214 ps.Y = value.Y;
215 ps.Z = value.Z; 215 ps.Z = value.Z;
216 this._character.Position = ps; 216 this._character.Position = ps;
217 } 217 }
218 } 218 }
219 219
220 public override PhysicsVector Velocity 220 public override PhysicsVector Velocity
221 { 221 {
222 get 222 get
223 { 223 {
224 return _velocity; 224 return _velocity;
225 } 225 }
226 set 226 set
227 { 227 {
228 _velocity = value; 228 _velocity = value;
229 } 229 }
230 } 230 }
231 231
232 public override bool Kinematic 232 public override bool Kinematic
233 { 233 {
234 get 234 get
235 { 235 {
236 return false; 236 return false;
237 } 237 }
238 set 238 set
239 { 239 {
240 240
241 } 241 }
242 } 242 }
243 243
244 public override Quaternion Orientation 244 public override Quaternion Orientation
245 { 245 {
246 get 246 get
247 { 247 {
248 return Quaternion.Identity; 248 return Quaternion.Identity;
249 } 249 }
250 set 250 set
251 { 251 {
252 252
253 } 253 }
254 } 254 }
255 255
256 public override PhysicsVector Acceleration 256 public override PhysicsVector Acceleration
257 { 257 {
258 get 258 get
259 { 259 {
260 return _acceleration; 260 return _acceleration;
261 } 261 }
262 262
263 } 263 }
264 public void SetAcceleration (PhysicsVector accel) 264 public void SetAcceleration (PhysicsVector accel)
265 { 265 {
266 this._acceleration = accel; 266 this._acceleration = accel;
267 } 267 }
268 268
269 public override void AddForce(PhysicsVector force) 269 public override void AddForce(PhysicsVector force)
270 { 270 {
271 271
272 } 272 }
273 273
274 public override void SetMomentum(PhysicsVector momentum) 274 public override void SetMomentum(PhysicsVector momentum)
275 { 275 {
276 276
277 } 277 }
278 278
279 public void Move(float timeStep) 279 public void Move(float timeStep)
280 { 280 {
281 Vec3 vec = new Vec3(); 281 Vec3 vec = new Vec3();
282 vec.X = this._velocity.X * timeStep; 282 vec.X = this._velocity.X * timeStep;
283 vec.Y = this._velocity.Y * timeStep; 283 vec.Y = this._velocity.Y * timeStep;
284 if(flying) 284 if(flying)
285 { 285 {
286 vec.Z = ( this._velocity.Z) * timeStep; 286 vec.Z = ( this._velocity.Z) * timeStep;
287 } 287 }
288 else 288 else
289 { 289 {
290 gravityAccel+= -9.8f; 290 gravityAccel+= -9.8f;
291 vec.Z = (gravityAccel + this._velocity.Z) * timeStep; 291 vec.Z = (gravityAccel + this._velocity.Z) * timeStep;
292 } 292 }
293 int res = this._character.Move(vec); 293 int res = this._character.Move(vec);
294 if(res == 1) 294 if(res == 1)
295 { 295 {
296 gravityAccel = 0; 296 gravityAccel = 0;
297 } 297 }
298 } 298 }
299 299
300 public void UpdatePosition() 300 public void UpdatePosition()
301 { 301 {
302 Vec3 vec = this._character.Position; 302 Vec3 vec = this._character.Position;
303 this._position.X = vec.X; 303 this._position.X = vec.X;
304 this._position.Y = vec.Y; 304 this._position.Y = vec.Y;
305 this._position.Z = vec.Z; 305 this._position.Z = vec.Z;
306 } 306 }
307 } 307 }
308 308
309 public class PhysXPrim : PhysicsActor 309 public class PhysXPrim : PhysicsActor
310 { 310 {
311 private PhysicsVector _position; 311 private PhysicsVector _position;
312 private PhysicsVector _velocity; 312 private PhysicsVector _velocity;
313 private PhysicsVector _acceleration; 313 private PhysicsVector _acceleration;
314 private NxActor _prim; 314 private NxActor _prim;
315 315
316 public PhysXPrim(NxActor prim) 316 public PhysXPrim(NxActor prim)
317 { 317 {
318 _velocity = new PhysicsVector(); 318 _velocity = new PhysicsVector();
319 _position = new PhysicsVector(); 319 _position = new PhysicsVector();
320 _acceleration = new PhysicsVector(); 320 _acceleration = new PhysicsVector();
321 _prim = prim; 321 _prim = prim;
322 } 322 }
323 public override bool Flying 323 public override bool Flying
324 { 324 {
325 get 325 get
326 { 326 {
327 return false; //no flying prims for you 327 return false; //no flying prims for you
328 } 328 }
329 set 329 set
330 { 330 {
331 331
332 } 332 }
333 } 333 }
334 public override PhysicsVector Position 334 public override PhysicsVector Position
335 { 335 {
336 get 336 get
337 { 337 {
338 PhysicsVector pos = new PhysicsVector(); 338 PhysicsVector pos = new PhysicsVector();
339 Vec3 vec = this._prim.Position; 339 Vec3 vec = this._prim.Position;
340 pos.X = vec.X; 340 pos.X = vec.X;
341 pos.Y = vec.Y; 341 pos.Y = vec.Y;
342 pos.Z = vec.Z; 342 pos.Z = vec.Z;
343 return pos; 343 return pos;
344 344
345 } 345 }
346 set 346 set
347 { 347 {
348 PhysicsVector vec = value; 348 PhysicsVector vec = value;
349 Vec3 pos = new Vec3(); 349 Vec3 pos = new Vec3();
350 pos.X = vec.X; 350 pos.X = vec.X;
351 pos.Y = vec.Y; 351 pos.Y = vec.Y;
352 pos.Z = vec.Z; 352 pos.Z = vec.Z;
353 this._prim.Position = pos; 353 this._prim.Position = pos;
354 } 354 }
355 } 355 }
356 356
357 public override PhysicsVector Velocity 357 public override PhysicsVector Velocity
358 { 358 {
359 get 359 get
360 { 360 {
361 return _velocity; 361 return _velocity;
362 } 362 }
363 set 363 set
364 { 364 {
365 _velocity = value; 365 _velocity = value;
366 } 366 }
367 } 367 }
368 368
369 public override bool Kinematic 369 public override bool Kinematic
370 { 370 {
371 get 371 get
372 { 372 {
373 return this._prim.Kinematic; 373 return this._prim.Kinematic;
374 } 374 }
375 set 375 set
376 { 376 {
377 this._prim.Kinematic = value; 377 this._prim.Kinematic = value;
378 } 378 }
379 } 379 }
380 380
381 public override Quaternion Orientation 381 public override Quaternion Orientation
382 { 382 {
383 get 383 get
384 { 384 {
385 Quaternion res = new Quaternion(); 385 Quaternion res = new Quaternion();
386 PhysXWrapper.Quaternion quat = this._prim.GetOrientation(); 386 PhysXWrapper.Quaternion quat = this._prim.GetOrientation();
387 res.w = quat.W; 387 res.w = quat.W;
388 res.x = quat.X; 388 res.x = quat.X;
389 res.y = quat.Y; 389 res.y = quat.Y;
390 res.z = quat.Z; 390 res.z = quat.Z;
391 return res; 391 return res;
392 } 392 }
393 set 393 set
394 { 394 {
395 395
396 } 396 }
397 } 397 }
398 398
399 public override PhysicsVector Acceleration 399 public override PhysicsVector Acceleration
400 { 400 {
401 get 401 get
402 { 402 {
403 return _acceleration; 403 return _acceleration;
404 } 404 }
405 405
406 } 406 }
407 public void SetAcceleration (PhysicsVector accel) 407 public void SetAcceleration (PhysicsVector accel)
408 { 408 {
409 this._acceleration = accel; 409 this._acceleration = accel;
410 } 410 }
411 411
412 public override void AddForce(PhysicsVector force) 412 public override void AddForce(PhysicsVector force)
413 { 413 {
414 414
415 } 415 }
416 416
417 public override void SetMomentum(PhysicsVector momentum) 417 public override void SetMomentum(PhysicsVector momentum)
418 { 418 {
419 419
420 } 420 }
421 421
422 422
423 } 423 }
424 424
425} 425}