aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BasicPhysicsPlugin
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-03 21:44:39 +1000
committerDavid Walter Seikel2016-11-03 21:44:39 +1000
commit134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch)
tree216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Region/Physics/BasicPhysicsPlugin
parentMore changing to production grid. Double oops. (diff)
downloadopensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Region/Physics/BasicPhysicsPlugin')
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs58
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs311
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs64
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs315
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs194
5 files changed, 0 insertions, 942 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
deleted file mode 100644
index fb9cb66..0000000
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
+++ /dev/null
@@ -1,58 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
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
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
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Reflection;
29using System.Runtime.InteropServices;
30
31// Information about this assembly is defined by the following
32// attributes.
33//
34// change them to the information which is associated with the assembly
35// you compile.
36
37[assembly : AssemblyTitle("BasicPhysicsPlugin")]
38[assembly : AssemblyDescription("")]
39[assembly : AssemblyConfiguration("")]
40[assembly : AssemblyCompany("http://opensimulator.org")]
41[assembly : AssemblyProduct("BasicPhysicsPlugin")]
42[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers")]
43[assembly : AssemblyTrademark("")]
44[assembly : AssemblyCulture("")]
45
46// This sets the default COM visibility of types in the assembly to invisible.
47// If you need to expose a type to COM, use [ComVisible(true)] on that type.
48
49[assembly : ComVisible(false)]
50
51// The assembly version has following format :
52//
53// Major.Minor.Build.Revision
54//
55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default):
57
58[assembly : AssemblyVersion("0.7.5.*")]
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
deleted file mode 100644
index e43136a..0000000
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
+++ /dev/null
@@ -1,311 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
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
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
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using Nini.Config;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Region.Physics.Manager;
34
35namespace OpenSim.Region.Physics.BasicPhysicsPlugin
36{
37 public class BasicActor : PhysicsActor
38 {
39 private Vector3 _size;
40
41 public BasicActor(Vector3 size)
42 {
43 Size = size;
44 }
45
46 public override int PhysicsActorType
47 {
48 get { return (int) ActorTypes.Agent; }
49 set { return; }
50 }
51
52 public override Vector3 RotationalVelocity { get; set; }
53
54 public override bool SetAlwaysRun
55 {
56 get { return false; }
57 set { return; }
58 }
59
60 public override uint LocalID
61 {
62 set { return; }
63 }
64
65 public override bool Grabbed
66 {
67 set { return; }
68 }
69
70 public override bool Selected
71 {
72 set { return; }
73 }
74
75 public override float Buoyancy
76 {
77 get { return 0f; }
78 set { return; }
79 }
80
81 public override bool FloatOnWater
82 {
83 set { return; }
84 }
85
86 public override bool IsPhysical
87 {
88 get { return false; }
89 set { return; }
90 }
91
92 public override bool ThrottleUpdates
93 {
94 get { return false; }
95 set { return; }
96 }
97
98 public override bool Flying { get; set; }
99
100 public override bool IsColliding { get; set; }
101
102 public override bool CollidingGround
103 {
104 get { return false; }
105 set { return; }
106 }
107
108 public override bool CollidingObj
109 {
110 get { return false; }
111 set { return; }
112 }
113
114 public override bool Stopped
115 {
116 get { return false; }
117 }
118
119 public override Vector3 Position { get; set; }
120
121 public override Vector3 Size
122 {
123 get { return _size; }
124 set {
125 _size = value;
126 _size.Z = _size.Z / 2.0f;
127 }
128 }
129
130 public override PrimitiveBaseShape Shape
131 {
132 set { return; }
133 }
134
135 public override float Mass
136 {
137 get { return 0f; }
138 }
139
140 public override Vector3 Force
141 {
142 get { return Vector3.Zero; }
143 set { return; }
144 }
145
146 public override int VehicleType
147 {
148 get { return 0; }
149 set { return; }
150 }
151
152 public override void VehicleFloatParam(int param, float value)
153 {
154
155 }
156
157 public override void VehicleVectorParam(int param, Vector3 value)
158 {
159
160 }
161
162 public override void VehicleRotationParam(int param, Quaternion rotation)
163 {
164
165 }
166
167 public override void VehicleFlags(int param, bool remove)
168 {
169
170 }
171
172 public override void SetVolumeDetect(int param)
173 {
174
175 }
176
177 public override Vector3 CenterOfMass
178 {
179 get { return Vector3.Zero; }
180 }
181
182 public override Vector3 GeometricCenter
183 {
184 get { return Vector3.Zero; }
185 }
186
187 public override Vector3 Velocity { get; set; }
188
189 public override Vector3 Torque
190 {
191 get { return Vector3.Zero; }
192 set { return; }
193 }
194
195 public override float CollisionScore
196 {
197 get { return 0f; }
198 set { }
199 }
200
201 public override Quaternion Orientation
202 {
203 get { return Quaternion.Identity; }
204 set { }
205 }
206
207 public override Vector3 Acceleration { get; set; }
208
209 public override bool Kinematic
210 {
211 get { return true; }
212 set { }
213 }
214
215 public override void link(PhysicsActor obj)
216 {
217 }
218
219 public override void delink()
220 {
221 }
222
223 public override void LockAngularMotion(Vector3 axis)
224 {
225 }
226
227 public override void AddForce(Vector3 force, bool pushforce)
228 {
229 }
230
231 public override void AddAngularForce(Vector3 force, bool pushforce)
232 {
233 }
234
235 public override void SetMomentum(Vector3 momentum)
236 {
237 }
238
239 public override void CrossingFailure()
240 {
241 }
242
243 public override Vector3 PIDTarget
244 {
245 set { return; }
246 }
247
248 public override bool PIDActive
249 {
250 set { return; }
251 }
252
253 public override float PIDTau
254 {
255 set { return; }
256 }
257
258 public override float PIDHoverHeight
259 {
260 set { return; }
261 }
262
263 public override bool PIDHoverActive
264 {
265 set { return; }
266 }
267
268 public override PIDHoverType PIDHoverType
269 {
270 set { return; }
271 }
272
273 public override float PIDHoverTau
274 {
275 set { return; }
276 }
277
278 public override Quaternion APIDTarget
279 {
280 set { return; }
281 }
282
283 public override bool APIDActive
284 {
285 set { return; }
286 }
287
288 public override float APIDStrength
289 {
290 set { return; }
291 }
292
293 public override float APIDDamping
294 {
295 set { return; }
296 }
297
298 public override void SubscribeEvents(int ms)
299 {
300 }
301
302 public override void UnSubscribeEvents()
303 {
304 }
305
306 public override bool SubscribedEvents()
307 {
308 return false;
309 }
310 }
311}
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
deleted file mode 100644
index 7ab2a03..0000000
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
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
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
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using Nini.Config;
31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager;
33
34namespace OpenSim.Region.Physics.BasicPhysicsPlugin
35{
36 /// <summary>
37 /// Effectively a physics plugin that simulates no physics at all.
38 /// </summary>
39 public class BasicPhysicsPlugin : IPhysicsPlugin
40 {
41 public BasicPhysicsPlugin()
42 {
43 }
44
45 public bool Init()
46 {
47 return true;
48 }
49
50 public PhysicsScene GetScene(string sceneIdentifier)
51 {
52 return new BasicScene(sceneIdentifier);
53 }
54
55 public string GetName()
56 {
57 return ("basicphysics");
58 }
59
60 public void Dispose()
61 {
62 }
63 }
64}
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs
deleted file mode 100644
index 47d7df3..0000000
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs
+++ /dev/null
@@ -1,315 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
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
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
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using Nini.Config;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Region.Physics.Manager;
34
35namespace OpenSim.Region.Physics.BasicPhysicsPlugin
36{
37 public class BasicPhysicsPrim : PhysicsActor
38 {
39 private Vector3 _size;
40// private PrimitiveBaseShape _shape;
41
42 public BasicPhysicsPrim(
43 string name, uint localId, Vector3 position, Vector3 size, Quaternion orientation, PrimitiveBaseShape shape)
44 {
45 Name = name;
46 LocalID = localId;
47 Position = position;
48 Size = size;
49 Orientation = orientation;
50 Shape = shape;
51 }
52
53 public override int PhysicsActorType
54 {
55 get { return (int) ActorTypes.Agent; }
56 set { return; }
57 }
58
59 public override Vector3 RotationalVelocity { get; set; }
60
61 public override bool SetAlwaysRun
62 {
63 get { return false; }
64 set { return; }
65 }
66
67 public override uint LocalID
68 {
69 set { return; }
70 }
71
72 public override bool Grabbed
73 {
74 set { return; }
75 }
76
77 public override bool Selected
78 {
79 set { return; }
80 }
81
82 public override float Buoyancy
83 {
84 get { return 0f; }
85 set { return; }
86 }
87
88 public override bool FloatOnWater
89 {
90 set { return; }
91 }
92
93 public override bool IsPhysical
94 {
95 get { return false; }
96 set { return; }
97 }
98
99 public override bool ThrottleUpdates
100 {
101 get { return false; }
102 set { return; }
103 }
104
105 public override bool Flying { get; set; }
106
107 public override bool IsColliding { get; set; }
108
109 public override bool CollidingGround
110 {
111 get { return false; }
112 set { return; }
113 }
114
115 public override bool CollidingObj
116 {
117 get { return false; }
118 set { return; }
119 }
120
121 public override bool Stopped
122 {
123 get { return false; }
124 }
125
126 public override Vector3 Position { get; set; }
127
128 public override Vector3 Size
129 {
130 get { return _size; }
131 set {
132 _size = value;
133 _size.Z = _size.Z / 2.0f;
134 }
135 }
136
137 public override PrimitiveBaseShape Shape
138 {
139// set { _shape = value; }
140 set {}
141 }
142
143 public override float Mass
144 {
145 get { return 0f; }
146 }
147
148 public override Vector3 Force
149 {
150 get { return Vector3.Zero; }
151 set { return; }
152 }
153
154 public override int VehicleType
155 {
156 get { return 0; }
157 set { return; }
158 }
159
160 public override void VehicleFloatParam(int param, float value)
161 {
162
163 }
164
165 public override void VehicleVectorParam(int param, Vector3 value)
166 {
167
168 }
169
170 public override void VehicleRotationParam(int param, Quaternion rotation)
171 {
172
173 }
174
175 public override void VehicleFlags(int param, bool remove)
176 {
177
178 }
179
180 public override void SetVolumeDetect(int param)
181 {
182
183 }
184
185 public override Vector3 CenterOfMass
186 {
187 get { return Vector3.Zero; }
188 }
189
190 public override Vector3 GeometricCenter
191 {
192 get { return Vector3.Zero; }
193 }
194
195 public override Vector3 Velocity { get; set; }
196
197 public override Vector3 Torque
198 {
199 get { return Vector3.Zero; }
200 set { return; }
201 }
202
203 public override float CollisionScore
204 {
205 get { return 0f; }
206 set { }
207 }
208
209 public override Quaternion Orientation { get; set; }
210
211 public override Vector3 Acceleration { get; set; }
212
213 public override bool Kinematic
214 {
215 get { return true; }
216 set { }
217 }
218
219 public override void link(PhysicsActor obj)
220 {
221 }
222
223 public override void delink()
224 {
225 }
226
227 public override void LockAngularMotion(Vector3 axis)
228 {
229 }
230
231 public override void AddForce(Vector3 force, bool pushforce)
232 {
233 }
234
235 public override void AddAngularForce(Vector3 force, bool pushforce)
236 {
237 }
238
239 public override void SetMomentum(Vector3 momentum)
240 {
241 }
242
243 public override void CrossingFailure()
244 {
245 }
246
247 public override Vector3 PIDTarget
248 {
249 set { return; }
250 }
251
252 public override bool PIDActive
253 {
254 set { return; }
255 }
256
257 public override float PIDTau
258 {
259 set { return; }
260 }
261
262 public override float PIDHoverHeight
263 {
264 set { return; }
265 }
266
267 public override bool PIDHoverActive
268 {
269 set { return; }
270 }
271
272 public override PIDHoverType PIDHoverType
273 {
274 set { return; }
275 }
276
277 public override float PIDHoverTau
278 {
279 set { return; }
280 }
281
282 public override Quaternion APIDTarget
283 {
284 set { return; }
285 }
286
287 public override bool APIDActive
288 {
289 set { return; }
290 }
291
292 public override float APIDStrength
293 {
294 set { return; }
295 }
296
297 public override float APIDDamping
298 {
299 set { return; }
300 }
301
302 public override void SubscribeEvents(int ms)
303 {
304 }
305
306 public override void UnSubscribeEvents()
307 {
308 }
309
310 public override bool SubscribedEvents()
311 {
312 return false;
313 }
314 }
315}
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
deleted file mode 100644
index f5826ed..0000000
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
+++ /dev/null
@@ -1,194 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
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
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
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using Nini.Config;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Region.Physics.Manager;
34
35namespace OpenSim.Region.Physics.BasicPhysicsPlugin
36{
37 /// <summary>
38 /// This is an incomplete extremely basic physics implementation
39 /// </summary>
40 /// <remarks>
41 /// Not useful for anything at the moment apart from some regression testing in other components where some form
42 /// of physics plugin is needed.
43 /// </remarks>
44 public class BasicScene : PhysicsScene
45 {
46 private List<BasicActor> _actors = new List<BasicActor>();
47 private List<BasicPhysicsPrim> _prims = new List<BasicPhysicsPrim>();
48 private float[] _heightMap;
49
50 //protected internal string sceneIdentifier;
51
52 public BasicScene(string _sceneIdentifier)
53 {
54 //sceneIdentifier = _sceneIdentifier;
55 }
56
57 public override void Initialise(IMesher meshmerizer, IConfigSource config)
58 {
59 }
60
61 public override void Dispose() {}
62
63 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
64 Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
65 {
66 BasicPhysicsPrim prim = new BasicPhysicsPrim(primName, localid, position, size, rotation, pbs);
67 prim.IsPhysical = isPhysical;
68
69 _prims.Add(prim);
70
71 return prim;
72 }
73
74 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
75 {
76 BasicActor act = new BasicActor(size);
77 act.Position = position;
78 act.Flying = isFlying;
79 _actors.Add(act);
80 return act;
81 }
82
83 public override void RemovePrim(PhysicsActor actor)
84 {
85 BasicPhysicsPrim prim = (BasicPhysicsPrim)actor;
86 if (_prims.Contains(prim))
87 _prims.Remove(prim);
88 }
89
90 public override void RemoveAvatar(PhysicsActor actor)
91 {
92 BasicActor act = (BasicActor)actor;
93 if (_actors.Contains(act))
94 _actors.Remove(act);
95 }
96
97 public override void AddPhysicsActorTaint(PhysicsActor prim)
98 {
99 }
100
101 public override float Simulate(float timeStep)
102 {
103 float fps = 0;
104 for (int i = 0; i < _actors.Count; ++i)
105 {
106 BasicActor actor = _actors[i];
107 Vector3 actorPosition = actor.Position;
108 Vector3 actorVelocity = actor.Velocity;
109
110 actorPosition.X += actor.Velocity.X*timeStep;
111 actorPosition.Y += actor.Velocity.Y*timeStep;
112
113 if (actor.Position.Y < 0)
114 {
115 actorPosition.Y = 0.1F;
116 }
117 else if (actor.Position.Y >= Constants.RegionSize)
118 {
119 actorPosition.Y = ((int)Constants.RegionSize - 0.1f);
120 }
121
122 if (actor.Position.X < 0)
123 {
124 actorPosition.X = 0.1F;
125 }
126 else if (actor.Position.X >= Constants.RegionSize)
127 {
128 actorPosition.X = ((int)Constants.RegionSize - 0.1f);
129 }
130
131 float terrainHeight = 0;
132 if (_heightMap != null)
133 terrainHeight = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X];
134
135 float height = terrainHeight + actor.Size.Z;
136
137 if (actor.Flying)
138 {
139 if (actor.Position.Z + (actor.Velocity.Z * timeStep) < terrainHeight + 2)
140 {
141 actorPosition.Z = height;
142 actorVelocity.Z = 0;
143 actor.IsColliding = true;
144 }
145 else
146 {
147 actorPosition.Z += actor.Velocity.Z * timeStep;
148 actor.IsColliding = false;
149 }
150 }
151 else
152 {
153 actorPosition.Z = height;
154 actorVelocity.Z = 0;
155 actor.IsColliding = true;
156 }
157
158 actor.Position = actorPosition;
159 actor.Velocity = actorVelocity;
160 }
161
162 return fps;
163 }
164
165 public override void GetResults()
166 {
167 }
168
169 public override bool IsThreaded
170 {
171 get { return (false); // for now we won't be multithreaded
172 }
173 }
174
175 public override void SetTerrain(float[] heightMap)
176 {
177 _heightMap = heightMap;
178 }
179
180 public override void DeleteTerrain()
181 {
182 }
183
184 public override void SetWaterLevel(float baseheight)
185 {
186 }
187
188 public override Dictionary<uint, float> GetTopColliders()
189 {
190 Dictionary<uint, float> returncolliders = new Dictionary<uint, float>();
191 return returncolliders;
192 }
193 }
194}