Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork

avinationmerge
ubit 2012-12-07 16:56:36 +01:00
commit 0a131bf9a7
6 changed files with 68 additions and 6 deletions

View File

@ -275,7 +275,8 @@ namespace OpenSim.Framework
size += pelvisToFoot; size += pelvisToFoot;
m_standSize = new Vector3(0.45f, 0.6f, size); m_standSize = new Vector3(0.45f, 0.6f, size);
m_feetOffset = 0.5f * size - pelvisToFoot; // m_feetOffset = 0.5f * size - pelvisToFoot;
m_feetOffset = 0.0f;
} }
} }
} }

View File

@ -174,12 +174,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// m_log.DebugFormat( // m_log.DebugFormat(
// "[AVFACTORY]: Setting visual params for {0} to {1}", // "[AVFACTORY]: Setting visual params for {0} to {1}",
// client.Name, string.Join(", ", visualParamsStrings)); // client.Name, string.Join(", ", visualParamsStrings));
/*
float oldHeight = sp.Appearance.AvatarHeight; float oldHeight = sp.Appearance.AvatarHeight;
changed = sp.Appearance.SetVisualParams(visualParams); changed = sp.Appearance.SetVisualParams(visualParams);
if (sp.Appearance.AvatarHeight != oldHeight && sp.Appearance.AvatarHeight > 0) if (sp.Appearance.AvatarHeight != oldHeight && sp.Appearance.AvatarHeight > 0)
((ScenePresence)sp).SetHeight(sp.Appearance.AvatarHeight); ((ScenePresence)sp).SetHeight(sp.Appearance.AvatarHeight);
*/
float oldoff = sp.Appearance.AvatarFeetOffset;
Vector3 oldbox = sp.Appearance.AvatarBoxSize;
changed = sp.Appearance.SetVisualParams(visualParams);
float off = sp.Appearance.AvatarFeetOffset;
Vector3 box = sp.Appearance.AvatarBoxSize;
if(oldoff != off || oldbox != box)
((ScenePresence)sp).SetSize(box,off);
} }
// Process the baked texture array // Process the baked texture array

View File

@ -1260,6 +1260,12 @@ namespace OpenSim.Region.Framework.Scenes
PhysicsActor.Size = new Vector3(0.45f, 0.6f, height); PhysicsActor.Size = new Vector3(0.45f, 0.6f, height);
} }
public void SetSize(Vector3 size, float feetoffset)
{
if (PhysicsActor != null && !IsChildAgent)
PhysicsActor.setAvatarSize(size, feetoffset);
}
/// <summary> /// <summary>
/// Complete Avatar's movement into the region. /// Complete Avatar's movement into the region.
/// </summary> /// </summary>

View File

@ -175,6 +175,11 @@ namespace OpenSim.Region.Physics.Manager
public abstract Vector3 Size { get; set; } public abstract Vector3 Size { get; set; }
public virtual void setAvatarSize(Vector3 size, float feetOffset)
{
Size = size;
}
public virtual bool Phantom { get; set; } public virtual bool Phantom { get; set; }
public virtual bool IsVolumeDtc public virtual bool IsVolumeDtc

View File

@ -90,13 +90,12 @@ namespace OpenSim.Region.Physics.OdePlugin
public float PID_D; public float PID_D;
public float PID_P; public float PID_P;
private float m_feetOffset = 0;
private float feetOff = 0; private float feetOff = 0;
private float feetSZ = 0.5f; private float feetSZ = 0.5f;
const float feetScale = 0.8f; const float feetScale = 0.8f;
const float sizeZAdjust = 0.18f;
private float boneOff = 0; private float boneOff = 0;
public float walkDivisor = 1.3f; public float walkDivisor = 1.3f;
public float runDivisor = 0.8f; public float runDivisor = 0.8f;
private bool flying = false; private bool flying = false;
@ -475,6 +474,28 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
} }
public override void setAvatarSize(Vector3 size, float feetOffset)
{
if (size.IsFinite())
{
if (size.X < 0.01f)
size.X = 0.01f;
if (size.Y < 0.01f)
size.Y = 0.01f;
if (size.Z < 0.01f)
size.Z = 0.01f;
strAvatarSize st = new strAvatarSize();
st.size = size;
st.offset = feetOffset;
AddChange(changes.AvatarSize, st);
}
else
{
m_log.Warn("[PHYSICS]: Got a NaN AvatarSize from Scene on a Character");
}
}
/// <summary> /// <summary>
/// This creates the Avatar's physical Surrogate at the position supplied /// This creates the Avatar's physical Surrogate at the position supplied
/// </summary> /// </summary>
@ -673,7 +694,8 @@ namespace OpenSim.Region.Physics.OdePlugin
// sizes one day should came from visual parameters // sizes one day should came from visual parameters
float sx = m_size.X; float sx = m_size.X;
float sy = m_size.Y; float sy = m_size.Y;
float sz = m_size.Z + sizeZAdjust; float sz = m_size.Z;
float topsx = sx * 0.9f; float topsx = sx * 0.9f;
float midsx = sx; float midsx = sx;
@ -693,7 +715,7 @@ namespace OpenSim.Region.Physics.OdePlugin
float midsz = sz - topsz - feetsz; float midsz = sz - topsz - feetsz;
float bonesz = sz; float bonesz = sz;
float bot = -sz * 0.5f; float bot = -sz * 0.5f + m_feetOffset;
boneOff = bot + 0.3f; boneOff = bot + 0.3f;
@ -754,6 +776,7 @@ namespace OpenSim.Region.Physics.OdePlugin
d.GeomSetOffsetPosition(feetbox, 0, 0, feetz); d.GeomSetOffsetPosition(feetbox, 0, 0, feetz);
d.GeomSetOffsetPosition(midbox, 0, 0, midz); d.GeomSetOffsetPosition(midbox, 0, 0, midz);
d.GeomSetOffsetPosition(topbox, 0, 0, topz); d.GeomSetOffsetPosition(topbox, 0, 0, topz);
d.GeomSetOffsetPosition(bonebox, 0, 0, m_feetOffset);
// The purpose of the AMotor here is to keep the avatar's physical // The purpose of the AMotor here is to keep the avatar's physical
// surrogate from rotating while moving // surrogate from rotating while moving
@ -1402,6 +1425,12 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
} }
private void changeAvatarSize(strAvatarSize st)
{
m_feetOffset = st.offset;
changeSize(st.size);
}
private void changeSize(Vector3 pSize) private void changeSize(Vector3 pSize)
{ {
if (pSize.IsFinite()) if (pSize.IsFinite())
@ -1609,6 +1638,10 @@ namespace OpenSim.Region.Physics.OdePlugin
changeSize((Vector3)arg); changeSize((Vector3)arg);
break; break;
case changes.AvatarSize:
changeAvatarSize((strAvatarSize)arg);
break;
case changes.Momentum: case changes.Momentum:
changeMomentum((Vector3)arg); changeMomentum((Vector3)arg);
break; break;
@ -1656,5 +1689,12 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
_parent_scene.AddChange((PhysicsActor)this, what, arg); _parent_scene.AddChange((PhysicsActor)this, what, arg);
} }
private struct strAvatarSize
{
public Vector3 size;
public float offset;
}
} }
} }

View File

@ -147,6 +147,7 @@ namespace OpenSim.Region.Physics.OdePlugin
PIDHoverActive, PIDHoverActive,
Size, Size,
AvatarSize,
Shape, Shape,
PhysRepData, PhysRepData,
AddPhysRep, AddPhysRep,