aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
diff options
context:
space:
mode:
authorUbitUmarov2012-12-07 15:54:46 +0000
committerUbitUmarov2012-12-07 15:54:46 +0000
commitd2499c4c314b290c42f454913305d97c6eec92d6 (patch)
treed341f578da7a09e2dfce9733b16b5516b3c1314f /OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
parent fix regression (diff)
downloadopensim-SC-d2499c4c314b290c42f454913305d97c6eec92d6.zip
opensim-SC-d2499c4c314b290c42f454913305d97c6eec92d6.tar.gz
opensim-SC-d2499c4c314b290c42f454913305d97c6eec92d6.tar.bz2
opensim-SC-d2499c4c314b290c42f454913305d97c6eec92d6.tar.xz
*TEST* Use new avatar size in ubitODE.
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs48
1 files changed, 44 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
index fd6b8aa..9c245e6 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
@@ -90,13 +90,12 @@ namespace OpenSim.Region.Physics.OdePlugin
90 public float PID_D; 90 public float PID_D;
91 public float PID_P; 91 public float PID_P;
92 92
93 private float m_feetOffset = 0;
93 private float feetOff = 0; 94 private float feetOff = 0;
94 private float feetSZ = 0.5f; 95 private float feetSZ = 0.5f;
95 const float feetScale = 0.8f; 96 const float feetScale = 0.8f;
96 const float sizeZAdjust = 0.18f;
97 private float boneOff = 0; 97 private float boneOff = 0;
98 98
99
100 public float walkDivisor = 1.3f; 99 public float walkDivisor = 1.3f;
101 public float runDivisor = 0.8f; 100 public float runDivisor = 0.8f;
102 private bool flying = false; 101 private bool flying = false;
@@ -475,6 +474,28 @@ namespace OpenSim.Region.Physics.OdePlugin
475 } 474 }
476 } 475 }
477 476
477 public override void setAvatarSize(Vector3 size, float feetOffset)
478 {
479 if (size.IsFinite())
480 {
481 if (size.X < 0.01f)
482 size.X = 0.01f;
483 if (size.Y < 0.01f)
484 size.Y = 0.01f;
485 if (size.Z < 0.01f)
486 size.Z = 0.01f;
487
488 strAvatarSize st = new strAvatarSize();
489 st.size = size;
490 st.offset = feetOffset;
491 AddChange(changes.AvatarSize, st);
492 }
493 else
494 {
495 m_log.Warn("[PHYSICS]: Got a NaN AvatarSize from Scene on a Character");
496 }
497
498 }
478 /// <summary> 499 /// <summary>
479 /// This creates the Avatar's physical Surrogate at the position supplied 500 /// This creates the Avatar's physical Surrogate at the position supplied
480 /// </summary> 501 /// </summary>
@@ -673,7 +694,8 @@ namespace OpenSim.Region.Physics.OdePlugin
673 // sizes one day should came from visual parameters 694 // sizes one day should came from visual parameters
674 float sx = m_size.X; 695 float sx = m_size.X;
675 float sy = m_size.Y; 696 float sy = m_size.Y;
676 float sz = m_size.Z + sizeZAdjust; 697 float sz = m_size.Z;
698
677 699
678 float topsx = sx * 0.9f; 700 float topsx = sx * 0.9f;
679 float midsx = sx; 701 float midsx = sx;
@@ -693,7 +715,7 @@ namespace OpenSim.Region.Physics.OdePlugin
693 float midsz = sz - topsz - feetsz; 715 float midsz = sz - topsz - feetsz;
694 float bonesz = sz; 716 float bonesz = sz;
695 717
696 float bot = -sz * 0.5f; 718 float bot = -sz * 0.5f + m_feetOffset;
697 719
698 boneOff = bot + 0.3f; 720 boneOff = bot + 0.3f;
699 721
@@ -754,6 +776,7 @@ namespace OpenSim.Region.Physics.OdePlugin
754 d.GeomSetOffsetPosition(feetbox, 0, 0, feetz); 776 d.GeomSetOffsetPosition(feetbox, 0, 0, feetz);
755 d.GeomSetOffsetPosition(midbox, 0, 0, midz); 777 d.GeomSetOffsetPosition(midbox, 0, 0, midz);
756 d.GeomSetOffsetPosition(topbox, 0, 0, topz); 778 d.GeomSetOffsetPosition(topbox, 0, 0, topz);
779 d.GeomSetOffsetPosition(bonebox, 0, 0, m_feetOffset);
757 780
758 // The purpose of the AMotor here is to keep the avatar's physical 781 // The purpose of the AMotor here is to keep the avatar's physical
759 // surrogate from rotating while moving 782 // surrogate from rotating while moving
@@ -1402,6 +1425,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1402 { 1425 {
1403 } 1426 }
1404 1427
1428 private void changeAvatarSize(strAvatarSize st)
1429 {
1430 m_feetOffset = st.offset;
1431 changeSize(st.size);
1432 }
1433
1405 private void changeSize(Vector3 pSize) 1434 private void changeSize(Vector3 pSize)
1406 { 1435 {
1407 if (pSize.IsFinite()) 1436 if (pSize.IsFinite())
@@ -1609,6 +1638,10 @@ namespace OpenSim.Region.Physics.OdePlugin
1609 changeSize((Vector3)arg); 1638 changeSize((Vector3)arg);
1610 break; 1639 break;
1611 1640
1641 case changes.AvatarSize:
1642 changeAvatarSize((strAvatarSize)arg);
1643 break;
1644
1612 case changes.Momentum: 1645 case changes.Momentum:
1613 changeMomentum((Vector3)arg); 1646 changeMomentum((Vector3)arg);
1614 break; 1647 break;
@@ -1656,5 +1689,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1656 { 1689 {
1657 _parent_scene.AddChange((PhysicsActor)this, what, arg); 1690 _parent_scene.AddChange((PhysicsActor)this, what, arg);
1658 } 1691 }
1692
1693 private struct strAvatarSize
1694 {
1695 public Vector3 size;
1696 public float offset;
1697 }
1698
1659 } 1699 }
1660} 1700}