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/OdePlugin | |
parent | Did I forget to add IScript.cs? Yes I did... (diff) | |
download | opensim-SC-75f6c3d36455fa542e67c16a96c1fda61e9956d5.zip opensim-SC-75f6c3d36455fa542e67c16a96c1fda61e9956d5.tar.gz opensim-SC-75f6c3d36455fa542e67c16a96c1fda61e9956d5.tar.bz2 opensim-SC-75f6c3d36455fa542e67c16a96c1fda61e9956d5.tar.xz |
More prep work for adding prims to ODE physics
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 75 |
1 files changed, 44 insertions, 31 deletions
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 | } |