diff options
author | UbitUmarov | 2012-12-07 15:54:46 +0000 |
---|---|---|
committer | UbitUmarov | 2012-12-07 15:54:46 +0000 |
commit | d2499c4c314b290c42f454913305d97c6eec92d6 (patch) | |
tree | d341f578da7a09e2dfce9733b16b5516b3c1314f /OpenSim | |
parent | fix regression (diff) | |
download | opensim-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')
6 files changed, 68 insertions, 6 deletions
diff --git a/OpenSim/Framework/AvatarSkeleton.cs b/OpenSim/Framework/AvatarSkeleton.cs index 269099b..7a49f22 100644 --- a/OpenSim/Framework/AvatarSkeleton.cs +++ b/OpenSim/Framework/AvatarSkeleton.cs | |||
@@ -275,7 +275,8 @@ namespace OpenSim.Framework | |||
275 | size += pelvisToFoot; | 275 | size += pelvisToFoot; |
276 | 276 | ||
277 | m_standSize = new Vector3(0.45f, 0.6f, size); | 277 | m_standSize = new Vector3(0.45f, 0.6f, size); |
278 | m_feetOffset = 0.5f * size - pelvisToFoot; | 278 | // m_feetOffset = 0.5f * size - pelvisToFoot; |
279 | m_feetOffset = 0.0f; | ||
279 | } | 280 | } |
280 | } | 281 | } |
281 | } | 282 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 8496005..d557a28 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -174,12 +174,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
174 | // m_log.DebugFormat( | 174 | // m_log.DebugFormat( |
175 | // "[AVFACTORY]: Setting visual params for {0} to {1}", | 175 | // "[AVFACTORY]: Setting visual params for {0} to {1}", |
176 | // client.Name, string.Join(", ", visualParamsStrings)); | 176 | // client.Name, string.Join(", ", visualParamsStrings)); |
177 | 177 | /* | |
178 | float oldHeight = sp.Appearance.AvatarHeight; | 178 | float oldHeight = sp.Appearance.AvatarHeight; |
179 | changed = sp.Appearance.SetVisualParams(visualParams); | 179 | changed = sp.Appearance.SetVisualParams(visualParams); |
180 | 180 | ||
181 | if (sp.Appearance.AvatarHeight != oldHeight && sp.Appearance.AvatarHeight > 0) | 181 | if (sp.Appearance.AvatarHeight != oldHeight && sp.Appearance.AvatarHeight > 0) |
182 | ((ScenePresence)sp).SetHeight(sp.Appearance.AvatarHeight); | 182 | ((ScenePresence)sp).SetHeight(sp.Appearance.AvatarHeight); |
183 | */ | ||
184 | float oldoff = sp.Appearance.AvatarFeetOffset; | ||
185 | Vector3 oldbox = sp.Appearance.AvatarBoxSize; | ||
186 | changed = sp.Appearance.SetVisualParams(visualParams); | ||
187 | float off = sp.Appearance.AvatarFeetOffset; | ||
188 | Vector3 box = sp.Appearance.AvatarBoxSize; | ||
189 | if(oldoff != off || oldbox != box) | ||
190 | ((ScenePresence)sp).SetSize(box,off); | ||
191 | |||
183 | } | 192 | } |
184 | 193 | ||
185 | // Process the baked texture array | 194 | // Process the baked texture array |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f5d609d..b6eae8e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1260,6 +1260,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1260 | PhysicsActor.Size = new Vector3(0.45f, 0.6f, height); | 1260 | PhysicsActor.Size = new Vector3(0.45f, 0.6f, height); |
1261 | } | 1261 | } |
1262 | 1262 | ||
1263 | public void SetSize(Vector3 size, float feetoffset) | ||
1264 | { | ||
1265 | if (PhysicsActor != null && !IsChildAgent) | ||
1266 | PhysicsActor.setAvatarSize(size, feetoffset); | ||
1267 | } | ||
1268 | |||
1263 | /// <summary> | 1269 | /// <summary> |
1264 | /// Complete Avatar's movement into the region. | 1270 | /// Complete Avatar's movement into the region. |
1265 | /// </summary> | 1271 | /// </summary> |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index e1168bd..0405dad 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -175,6 +175,11 @@ namespace OpenSim.Region.Physics.Manager | |||
175 | 175 | ||
176 | public abstract Vector3 Size { get; set; } | 176 | public abstract Vector3 Size { get; set; } |
177 | 177 | ||
178 | public virtual void setAvatarSize(Vector3 size, float feetOffset) | ||
179 | { | ||
180 | Size = size; | ||
181 | } | ||
182 | |||
178 | public virtual bool Phantom { get; set; } | 183 | public virtual bool Phantom { get; set; } |
179 | 184 | ||
180 | public virtual bool IsVolumeDtc | 185 | public virtual bool IsVolumeDtc |
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 | } |
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index 2b4d368..7d1d2fe 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | |||
@@ -147,6 +147,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
147 | PIDHoverActive, | 147 | PIDHoverActive, |
148 | 148 | ||
149 | Size, | 149 | Size, |
150 | AvatarSize, | ||
150 | Shape, | 151 | Shape, |
151 | PhysRepData, | 152 | PhysRepData, |
152 | AddPhysRep, | 153 | AddPhysRep, |