* Fixed the walk vs fall animation.

* Tweaked a few things
afrisby
Teravus Ovares 2007-11-13 05:10:14 +00:00
parent 57b646b7ae
commit 10b41ba455
2 changed files with 71 additions and 7 deletions

View File

@ -458,7 +458,7 @@ namespace OpenSim.Region.Environment.Scenes
+ (((float)m_visualParams[125] / 255.0f) / 1.5f);
if (PhysicsActor != null)
{
PhysicsVector SetSize = new PhysicsVector(0, 0, m_avHeight);
PhysicsVector SetSize = new PhysicsVector(0.45f, 0.6f, m_avHeight);
PhysicsActor.Size = SetSize;
}
//OpenSim.Framework.Console.MainLog.Instance.Verbose("CLIENT", "Set Avatar Height to: " + (1.50856f + (((float)m_visualParams[25] / 255.0f) * (2.525506f - 1.50856f))).ToString() + "m" + " Leglength: " + ((float)m_visualParams[125]).ToString() + ":" + (((float)m_visualParams[125] / 255.0f)).ToString() + "m");
@ -681,11 +681,11 @@ namespace OpenSim.Region.Environment.Scenes
}
else
{
if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z > 6)
if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z < -6)
{
SendAnimPack(Animations.AnimsLLUUID["FALLDOWN"], 1);
}
else if (!PhysicsActor.IsColliding && Velocity.Z > 0)
else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && (m_movementflag & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
{
SendAnimPack(Animations.AnimsLLUUID["JUMP"], 1);
}
@ -716,11 +716,11 @@ namespace OpenSim.Region.Environment.Scenes
}
else
{
if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z > 6 && !m_physicsActor.Flying)
if (!PhysicsActor.IsColliding && m_physicsActor.Velocity.Z < -6 && !m_physicsActor.Flying)
{
SendAnimPack(Animations.AnimsLLUUID["FALLDOWN"], 1);
}
else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying)
else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying && (m_movementflag & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
{
SendAnimPack(Animations.AnimsLLUUID["JUMP"], 1);
}

View File

@ -659,11 +659,17 @@ namespace OpenSim.Region.Physics.OdePlugin
public float CAPSULE_LENGTH = 0.79f;
private bool flying = false;
private bool m_iscolliding = false;
private bool m_iscollidingGround = false;
private bool m_wascolliding = false;
private bool m_wascollidingGround = false;
private bool m_alwaysRun = false;
private bool m_hackSentFall = false;
private bool m_hackSentFly = false;
private string m_name = "";
private bool[] m_colliderarr = new bool[11];
private bool[] m_colliderGroundarr = new bool[11];
private bool jumping = false;
//private float gravityAccel;
@ -775,8 +781,50 @@ namespace OpenSim.Region.Physics.OdePlugin
}
public override bool CollidingGround
{
get { return false; }
set { return; }
get { return m_iscollidingGround; }
set
{
int i;
int truecount = 0;
int falsecount = 0;
if (m_colliderGroundarr.Length >= 10)
{
for (i = 0; i < 10; i++)
{
m_colliderGroundarr[i] = m_colliderGroundarr[i + 1];
}
}
m_colliderGroundarr[10] = value;
for (i = 0; i < 11; i++)
{
if (m_colliderGroundarr[i])
{
truecount++;
}
else
{
falsecount++;
}
}
// Equal truecounts and false counts means we're colliding with something.
if (falsecount > 1.2 * truecount)
{
m_iscollidingGround = false;
}
else
{
m_iscollidingGround = true;
}
if (m_wascollidingGround != m_iscollidingGround)
{
//base.SendCollisionUpdate(new CollisionEventUpdate());
}
m_wascollidingGround = m_iscollidingGround;
}
}
public override bool CollidingObj
{
@ -1017,7 +1065,23 @@ namespace OpenSim.Region.Physics.OdePlugin
vec = d.BodyGetLinearVel(Body);
_velocity.X = (vec.X);
_velocity.Y = (vec.Y);
_velocity.Z = (vec.Z);
if (_velocity.Z < -6 && !m_hackSentFall)
{
m_hackSentFall = true;
base.SendCollisionUpdate(new CollisionEventUpdate());
}
else if (flying && !m_hackSentFly)
{
//m_hackSentFly = true;
//base.SendCollisionUpdate(new CollisionEventUpdate());
}
else
{
m_hackSentFly = false;
m_hackSentFall = false;
}
}
}