diff options
author | Brian McBee | 2007-08-19 06:14:36 +0000 |
---|---|---|
committer | Brian McBee | 2007-08-19 06:14:36 +0000 |
commit | 75f6c3d36455fa542e67c16a96c1fda61e9956d5 (patch) | |
tree | 4f508956c035494af275359f65c87a1e742d4282 /OpenSim/Region/Physics | |
parent | Did I forget to add IScript.cs? Yes I did... (diff) | |
download | opensim-SC_OLD-75f6c3d36455fa542e67c16a96c1fda61e9956d5.zip opensim-SC_OLD-75f6c3d36455fa542e67c16a96c1fda61e9956d5.tar.gz opensim-SC_OLD-75f6c3d36455fa542e67c16a96c1fda61e9956d5.tar.bz2 opensim-SC_OLD-75f6c3d36455fa542e67c16a96c1fda61e9956d5.tar.xz |
More prep work for adding prims to ODE physics
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r-- | OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsActor.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 75 | ||||
-rw-r--r-- | OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | 25 |
4 files changed, 96 insertions, 33 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index a990318..92b6929 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | |||
@@ -203,6 +203,17 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
203 | } | 203 | } |
204 | } | 204 | } |
205 | 205 | ||
206 | public override PhysicsVector Size | ||
207 | { | ||
208 | get | ||
209 | { | ||
210 | return new PhysicsVector(0, 0, 0); | ||
211 | } | ||
212 | set | ||
213 | { | ||
214 | } | ||
215 | } | ||
216 | |||
206 | public override PhysicsVector Velocity | 217 | public override PhysicsVector Velocity |
207 | { | 218 | { |
208 | get | 219 | get |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index d0faf02..ed987b0 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -49,6 +49,12 @@ namespace OpenSim.Physics.Manager | |||
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | public abstract PhysicsVector Size | ||
53 | { | ||
54 | get; | ||
55 | set; | ||
56 | } | ||
57 | |||
52 | public abstract PhysicsVector Position | 58 | public abstract PhysicsVector Position |
53 | { | 59 | { |
54 | get; | 60 | get; |
@@ -103,6 +109,18 @@ namespace OpenSim.Physics.Manager | |||
103 | } | 109 | } |
104 | } | 110 | } |
105 | 111 | ||
112 | public override PhysicsVector Size | ||
113 | { | ||
114 | get | ||
115 | { | ||
116 | return PhysicsVector.Zero; | ||
117 | } | ||
118 | set | ||
119 | { | ||
120 | return; | ||
121 | } | ||
122 | } | ||
123 | |||
106 | public override PhysicsVector Velocity | 124 | public override PhysicsVector Velocity |
107 | { | 125 | { |
108 | get | 126 | get |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index af79e63..397ba6d 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -272,6 +272,18 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
272 | } | 272 | } |
273 | } | 273 | } |
274 | 274 | ||
275 | public override PhysicsVector Size | ||
276 | { | ||
277 | get | ||
278 | { | ||
279 | return new PhysicsVector(0,0,0); | ||
280 | } | ||
281 | set | ||
282 | { | ||
283 | } | ||
284 | } | ||
285 | |||
286 | |||
275 | public override PhysicsVector Velocity | 287 | public override PhysicsVector Velocity |
276 | { | 288 | { |
277 | get | 289 | get |
@@ -355,15 +367,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
355 | 367 | ||
356 | public class OdePrim : PhysicsActor | 368 | public class OdePrim : PhysicsActor |
357 | { | 369 | { |
358 | |||
359 | private PhysicsVector _position; | 370 | private PhysicsVector _position; |
360 | private PhysicsVector _velocity; | 371 | private PhysicsVector _velocity; |
361 | private PhysicsVector _size; | 372 | private PhysicsVector _size; |
362 | private PhysicsVector _acceleration; | 373 | private PhysicsVector _acceleration; |
363 | private Quaternion _orientation; | 374 | private Quaternion _orientation; |
364 | private IntPtr BoundingCapsule; | 375 | IntPtr prim_geom; |
365 | IntPtr capsule_geom; | ||
366 | d.Mass capsule_mass; | ||
367 | 376 | ||
368 | public OdePrim(OdeScene parent_scene, PhysicsVector pos, PhysicsVector size, Quaternion rotation) | 377 | public OdePrim(OdeScene parent_scene, PhysicsVector pos, PhysicsVector size, Quaternion rotation) |
369 | { | 378 | { |
@@ -371,14 +380,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
371 | _position = pos; | 380 | _position = pos; |
372 | _size = size; | 381 | _size = size; |
373 | _acceleration = new PhysicsVector(); | 382 | _acceleration = new PhysicsVector(); |
374 | d.MassSetCapsule(out capsule_mass, 50.0f, 3, 0.5f, 2f); | ||
375 | capsule_geom = d.CreateBox(OdeScene.space, _size.X, _size.Y, _size.Z); | ||
376 | this.BoundingCapsule = d.BodyCreate(OdeScene.world); | ||
377 | d.BodySetMass(BoundingCapsule, ref capsule_mass); | ||
378 | d.BodySetPosition(BoundingCapsule, pos.X, pos.Y, pos.Z); | ||
379 | d.GeomSetBody(capsule_geom, BoundingCapsule); | ||
380 | _orientation = rotation; | 383 | _orientation = rotation; |
384 | prim_geom = d.CreateBox(OdeScene.space, _size.X, _size.Y, _size.Z); | ||
385 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | ||
386 | d.Quaternion myrot = new d.Quaternion(); | ||
387 | myrot.W = rotation.w; | ||
388 | myrot.X = rotation.x; | ||
389 | myrot.Y = rotation.y; | ||
390 | myrot.Z = rotation.z; | ||
391 | d.GeomSetQuaternion(prim_geom, ref myrot); | ||
381 | } | 392 | } |
393 | |||
382 | public override bool Flying | 394 | public override bool Flying |
383 | { | 395 | { |
384 | get | 396 | get |
@@ -387,29 +399,31 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
387 | } | 399 | } |
388 | set | 400 | set |
389 | { | 401 | { |
390 | |||
391 | } | 402 | } |
392 | } | 403 | } |
404 | |||
393 | public override PhysicsVector Position | 405 | public override PhysicsVector Position |
394 | { | 406 | { |
395 | get | 407 | get |
396 | { | 408 | { |
397 | PhysicsVector pos = new PhysicsVector(); | 409 | return _position; |
398 | // PhysicsVector vec = this._prim.Position; | 410 | } |
399 | //pos.X = vec.X; | 411 | set |
400 | //pos.Y = vec.Y; | 412 | { |
401 | //pos.Z = vec.Z; | 413 | _position = value; |
402 | return pos; | 414 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); |
415 | } | ||
416 | } | ||
403 | 417 | ||
418 | public override PhysicsVector Size | ||
419 | { | ||
420 | get | ||
421 | { | ||
422 | return _size; | ||
404 | } | 423 | } |
405 | set | 424 | set |
406 | { | 425 | { |
407 | /*PhysicsVector vec = value; | 426 | _size = value; |
408 | PhysicsVector pos = new PhysicsVector(); | ||
409 | pos.X = vec.X; | ||
410 | pos.Y = vec.Y; | ||
411 | pos.Z = vec.Z; | ||
412 | this._prim.Position = pos;*/ | ||
413 | } | 427 | } |
414 | } | 428 | } |
415 | 429 | ||
@@ -430,11 +444,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
430 | get | 444 | get |
431 | { | 445 | { |
432 | return false; | 446 | return false; |
433 | //return this._prim.Kinematic; | ||
434 | } | 447 | } |
435 | set | 448 | set |
436 | { | 449 | { |
437 | //this._prim.Kinematic = value; | ||
438 | } | 450 | } |
439 | } | 451 | } |
440 | 452 | ||
@@ -447,6 +459,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
447 | set | 459 | set |
448 | { | 460 | { |
449 | _orientation = value; | 461 | _orientation = value; |
462 | d.Quaternion myrot = new d.Quaternion(); | ||
463 | myrot.W = _orientation.w; | ||
464 | myrot.X = _orientation.x; | ||
465 | myrot.Y = _orientation.y; | ||
466 | myrot.Z = _orientation.z; | ||
467 | d.GeomSetQuaternion(prim_geom, ref myrot); | ||
450 | } | 468 | } |
451 | } | 469 | } |
452 | 470 | ||
@@ -456,8 +474,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
456 | { | 474 | { |
457 | return _acceleration; | 475 | return _acceleration; |
458 | } | 476 | } |
459 | |||
460 | } | 477 | } |
478 | |||
461 | public void SetAcceleration(PhysicsVector accel) | 479 | public void SetAcceleration(PhysicsVector accel) |
462 | { | 480 | { |
463 | this._acceleration = accel; | 481 | this._acceleration = accel; |
@@ -465,15 +483,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
465 | 483 | ||
466 | public override void AddForce(PhysicsVector force) | 484 | public override void AddForce(PhysicsVector force) |
467 | { | 485 | { |
468 | |||
469 | } | 486 | } |
470 | 487 | ||
471 | public override void SetMomentum(PhysicsVector momentum) | 488 | public override void SetMomentum(PhysicsVector momentum) |
472 | { | 489 | { |
473 | |||
474 | } | 490 | } |
475 | |||
476 | |||
477 | } | 491 | } |
478 | |||
479 | } | 492 | } |
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index 679d233..f86eedf 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | |||
@@ -216,7 +216,17 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
216 | this._character.Position = ps; | 216 | this._character.Position = ps; |
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
220 | public override PhysicsVector Size | ||
221 | { | ||
222 | get | ||
223 | { | ||
224 | return new PhysicsVector(0,0,0); | ||
225 | } | ||
226 | set | ||
227 | { | ||
228 | } | ||
229 | } | ||
220 | public override PhysicsVector Velocity | 230 | public override PhysicsVector Velocity |
221 | { | 231 | { |
222 | get | 232 | get |
@@ -353,7 +363,18 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
353 | this._prim.Position = pos; | 363 | this._prim.Position = pos; |
354 | } | 364 | } |
355 | } | 365 | } |
356 | 366 | ||
367 | public override PhysicsVector Size | ||
368 | { | ||
369 | get | ||
370 | { | ||
371 | return new PhysicsVector(0, 0, 0); | ||
372 | } | ||
373 | set | ||
374 | { | ||
375 | } | ||
376 | } | ||
377 | |||
357 | public override PhysicsVector Velocity | 378 | public override PhysicsVector Velocity |
358 | { | 379 | { |
359 | get | 380 | get |