diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs | 345 |
1 files changed, 345 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs new file mode 100644 index 0000000..c0e24fd --- /dev/null +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs | |||
@@ -0,0 +1,345 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using Nini.Config; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Physics.Manager; | ||
33 | using PhysXWrapper; | ||
34 | using Quaternion=OpenMetaverse.Quaternion; | ||
35 | using System.Reflection; | ||
36 | using log4net; | ||
37 | using OpenMetaverse; | ||
38 | |||
39 | namespace OpenSim.Region.Physics.PhysXPlugin | ||
40 | { | ||
41 | public class PhysXPrim : PhysicsActor | ||
42 | { | ||
43 | private Vector3 _velocity; | ||
44 | private Vector3 _acceleration; | ||
45 | private Vector3 m_rotationalVelocity; | ||
46 | private NxActor _prim; | ||
47 | |||
48 | public PhysXPrim(NxActor prim) | ||
49 | { | ||
50 | _velocity = Vector3.Zero; | ||
51 | _acceleration = Vector3.Zero; | ||
52 | _prim = prim; | ||
53 | } | ||
54 | |||
55 | public override int PhysicsActorType | ||
56 | { | ||
57 | get { return (int) ActorTypes.Prim; } | ||
58 | set { return; } | ||
59 | } | ||
60 | |||
61 | public override bool IsPhysical | ||
62 | { | ||
63 | get { return false; } | ||
64 | set { return; } | ||
65 | } | ||
66 | |||
67 | public override bool SetAlwaysRun | ||
68 | { | ||
69 | get { return false; } | ||
70 | set { return; } | ||
71 | } | ||
72 | |||
73 | public override uint LocalID | ||
74 | { | ||
75 | set { return; } | ||
76 | } | ||
77 | |||
78 | public override bool Grabbed | ||
79 | { | ||
80 | set { return; } | ||
81 | } | ||
82 | |||
83 | public override bool Selected | ||
84 | { | ||
85 | set { return; } | ||
86 | } | ||
87 | |||
88 | public override float Buoyancy | ||
89 | { | ||
90 | get { return 0f; } | ||
91 | set { return; } | ||
92 | } | ||
93 | |||
94 | public override bool FloatOnWater | ||
95 | { | ||
96 | set { return; } | ||
97 | } | ||
98 | |||
99 | public override bool ThrottleUpdates | ||
100 | { | ||
101 | get { return false; } | ||
102 | set { return; } | ||
103 | } | ||
104 | |||
105 | public override Vector3 RotationalVelocity | ||
106 | { | ||
107 | get { return m_rotationalVelocity; } | ||
108 | set { m_rotationalVelocity = value; } | ||
109 | } | ||
110 | |||
111 | public override bool Flying | ||
112 | { | ||
113 | get { return false; //no flying prims for you | ||
114 | } | ||
115 | set { } | ||
116 | } | ||
117 | |||
118 | public override bool IsColliding | ||
119 | { | ||
120 | get { return false; } | ||
121 | set { } | ||
122 | } | ||
123 | |||
124 | public override bool CollidingGround | ||
125 | { | ||
126 | get { return false; } | ||
127 | set { return; } | ||
128 | } | ||
129 | |||
130 | public override bool CollidingObj | ||
131 | { | ||
132 | get { return false; } | ||
133 | set { return; } | ||
134 | } | ||
135 | |||
136 | public override bool Stopped | ||
137 | { | ||
138 | get { return false; } | ||
139 | } | ||
140 | |||
141 | public override Vector3 Position | ||
142 | { | ||
143 | get | ||
144 | { | ||
145 | Vector3 pos = Vector3.Zero; | ||
146 | Vec3 vec = _prim.Position; | ||
147 | pos.X = vec.X; | ||
148 | pos.Y = vec.Y; | ||
149 | pos.Z = vec.Z; | ||
150 | return pos; | ||
151 | } | ||
152 | set | ||
153 | { | ||
154 | Vector3 vec = value; | ||
155 | Vec3 pos = new Vec3(); | ||
156 | pos.X = vec.X; | ||
157 | pos.Y = vec.Y; | ||
158 | pos.Z = vec.Z; | ||
159 | _prim.Position = pos; | ||
160 | } | ||
161 | } | ||
162 | |||
163 | public override PrimitiveBaseShape Shape | ||
164 | { | ||
165 | set { return; } | ||
166 | } | ||
167 | |||
168 | public override Vector3 Velocity | ||
169 | { | ||
170 | get { return _velocity; } | ||
171 | set { _velocity = value; } | ||
172 | } | ||
173 | |||
174 | public override Vector3 Torque | ||
175 | { | ||
176 | get { return Vector3.Zero; } | ||
177 | set { return; } | ||
178 | } | ||
179 | |||
180 | public override float CollisionScore | ||
181 | { | ||
182 | get { return 0f; } | ||
183 | set { } | ||
184 | } | ||
185 | |||
186 | public override bool Kinematic | ||
187 | { | ||
188 | get { return _prim.Kinematic; } | ||
189 | set { _prim.Kinematic = value; } | ||
190 | } | ||
191 | |||
192 | public override Quaternion Orientation | ||
193 | { | ||
194 | get | ||
195 | { | ||
196 | Quaternion res; | ||
197 | PhysXWrapper.Quaternion quat = _prim.GetOrientation(); | ||
198 | res.W = quat.W; | ||
199 | res.X = quat.X; | ||
200 | res.Y = quat.Y; | ||
201 | res.Z = quat.Z; | ||
202 | return res; | ||
203 | } | ||
204 | set { } | ||
205 | } | ||
206 | |||
207 | public override Vector3 Acceleration | ||
208 | { | ||
209 | get { return _acceleration; } | ||
210 | } | ||
211 | |||
212 | public void SetAcceleration(Vector3 accel) | ||
213 | { | ||
214 | _acceleration = accel; | ||
215 | } | ||
216 | |||
217 | public override void AddForce(Vector3 force, bool pushforce) | ||
218 | { | ||
219 | } | ||
220 | |||
221 | public override void AddAngularForce(Vector3 force, bool pushforce) | ||
222 | { | ||
223 | } | ||
224 | |||
225 | public override void SetMomentum(Vector3 momentum) | ||
226 | { | ||
227 | } | ||
228 | |||
229 | public override Vector3 Size | ||
230 | { | ||
231 | get { return Vector3.Zero; } | ||
232 | set { } | ||
233 | } | ||
234 | |||
235 | public override void link(PhysicsActor obj) | ||
236 | { | ||
237 | } | ||
238 | |||
239 | public override void delink() | ||
240 | { | ||
241 | } | ||
242 | |||
243 | public override void LockAngularMotion(Vector3 axis) | ||
244 | { | ||
245 | |||
246 | } | ||
247 | |||
248 | public override float Mass | ||
249 | { | ||
250 | get { return 0f; } | ||
251 | } | ||
252 | |||
253 | public override Vector3 Force | ||
254 | { | ||
255 | get { return Vector3.Zero; } | ||
256 | set { return; } | ||
257 | } | ||
258 | |||
259 | public override int VehicleType | ||
260 | { | ||
261 | get { return 0; } | ||
262 | set { return; } | ||
263 | } | ||
264 | |||
265 | public override void VehicleFloatParam(int param, float value) | ||
266 | { | ||
267 | |||
268 | } | ||
269 | |||
270 | public override void VehicleVectorParam(int param, Vector3 value) | ||
271 | { | ||
272 | |||
273 | } | ||
274 | |||
275 | public override void VehicleRotationParam(int param, Quaternion rotation) | ||
276 | { | ||
277 | |||
278 | } | ||
279 | |||
280 | public override void VehicleFlags(int param, bool remove) { } | ||
281 | |||
282 | public override void SetVolumeDetect(int param) | ||
283 | { | ||
284 | |||
285 | } | ||
286 | |||
287 | public override Vector3 CenterOfMass | ||
288 | { | ||
289 | get { return Vector3.Zero; } | ||
290 | } | ||
291 | |||
292 | public override Vector3 GeometricCenter | ||
293 | { | ||
294 | get { return Vector3.Zero; } | ||
295 | } | ||
296 | |||
297 | public override void CrossingFailure() | ||
298 | { | ||
299 | } | ||
300 | |||
301 | public override Vector3 PIDTarget { set { return; } } | ||
302 | public override bool PIDActive { set { return; } } | ||
303 | public override float PIDTau { set { return; } } | ||
304 | |||
305 | public override float PIDHoverHeight { set { return; } } | ||
306 | public override bool PIDHoverActive { set { return; } } | ||
307 | public override PIDHoverType PIDHoverType { set { return; } } | ||
308 | public override float PIDHoverTau { set { return; } } | ||
309 | |||
310 | public override Quaternion APIDTarget | ||
311 | { | ||
312 | set { return; } | ||
313 | } | ||
314 | |||
315 | public override bool APIDActive | ||
316 | { | ||
317 | set { return; } | ||
318 | } | ||
319 | |||
320 | public override float APIDStrength | ||
321 | { | ||
322 | set { return; } | ||
323 | } | ||
324 | |||
325 | public override float APIDDamping | ||
326 | { | ||
327 | set { return; } | ||
328 | } | ||
329 | |||
330 | |||
331 | |||
332 | public override void SubscribeEvents(int ms) | ||
333 | { | ||
334 | |||
335 | } | ||
336 | public override void UnSubscribeEvents() | ||
337 | { | ||
338 | |||
339 | } | ||
340 | public override bool SubscribedEvents() | ||
341 | { | ||
342 | return false; | ||
343 | } | ||
344 | } | ||
345 | } | ||