diff options
author | UbitUmarov | 2012-04-28 21:36:38 +0100 |
---|---|---|
committer | UbitUmarov | 2012-04-28 21:36:38 +0100 |
commit | dd745f60c201aee7ff48ba81d567e7b38a8f186c (patch) | |
tree | d75ec7775942b912a72bc85d639d6f1dbb206072 /OpenSim/Region/Physics | |
parent | Oooops don't hover underground but do hover (diff) | |
download | opensim-SC_OLD-dd745f60c201aee7ff48ba81d567e7b38a8f186c.zip opensim-SC_OLD-dd745f60c201aee7ff48ba81d567e7b38a8f186c.tar.gz opensim-SC_OLD-dd745f60c201aee7ff48ba81d567e7b38a8f186c.tar.bz2 opensim-SC_OLD-dd745f60c201aee7ff48ba81d567e7b38a8f186c.tar.xz |
fix llGetCenterOfMass ( checked with ubitODE only)
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 2d587ab..c9a453d 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | |||
@@ -450,7 +450,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
450 | get | 450 | get |
451 | { | 451 | { |
452 | d.Vector3 dtmp; | 452 | d.Vector3 dtmp; |
453 | if (IsPhysical && !childPrim && Body != IntPtr.Zero) | 453 | if (!childPrim && Body != IntPtr.Zero) |
454 | { | 454 | { |
455 | dtmp = d.BodyGetPosition(Body); | 455 | dtmp = d.BodyGetPosition(Body); |
456 | return new Vector3(dtmp.X, dtmp.Y, dtmp.Z); | 456 | return new Vector3(dtmp.X, dtmp.Y, dtmp.Z); |
@@ -465,12 +465,38 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
465 | q.Z = dq.Z; | 465 | q.Z = dq.Z; |
466 | q.W = dq.W; | 466 | q.W = dq.W; |
467 | 467 | ||
468 | Vector3 vtmp = primOOBoffset * q; | 468 | Vector3 Ptot = primOOBoffset * q; |
469 | dtmp = d.GeomGetPosition(prim_geom); | 469 | dtmp = d.GeomGetPosition(prim_geom); |
470 | return new Vector3(dtmp.X + vtmp.X, dtmp.Y + vtmp.Y, dtmp.Z + vtmp.Z); | 470 | Ptot.X += dtmp.X; |
471 | Ptot.Y += dtmp.Y; | ||
472 | Ptot.Z += dtmp.Z; | ||
473 | |||
474 | // if(childPrim) we only know about physical linksets | ||
475 | return Ptot; | ||
476 | /* | ||
477 | float tmass = _mass; | ||
478 | Ptot *= tmass; | ||
479 | |||
480 | float m; | ||
481 | |||
482 | foreach (OdePrim prm in childrenPrim) | ||
483 | { | ||
484 | m = prm._mass; | ||
485 | Ptot += prm.CenterOfMass * m; | ||
486 | tmass += m; | ||
487 | } | ||
488 | |||
489 | if (tmass == 0) | ||
490 | tmass = 0; | ||
491 | else | ||
492 | tmass = 1.0f / tmass; | ||
493 | |||
494 | Ptot *= tmass; | ||
495 | return Ptot; | ||
496 | */ | ||
471 | } | 497 | } |
472 | else | 498 | else |
473 | return Vector3.Zero; | 499 | return _position; |
474 | } | 500 | } |
475 | } | 501 | } |
476 | /* | 502 | /* |
@@ -3490,7 +3516,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3490 | { | 3516 | { |
3491 | d.BodySetPosition(Body, lpos.X, lpos.Y, m_targetHoverHeight); | 3517 | d.BodySetPosition(Body, lpos.X, lpos.Y, m_targetHoverHeight); |
3492 | d.BodySetLinearVel(Body, vel.X, vel.Y, 0); | 3518 | d.BodySetLinearVel(Body, vel.X, vel.Y, 0); |
3493 | return; | ||
3494 | } | 3519 | } |
3495 | else | 3520 | else |
3496 | { | 3521 | { |