Merge branch 'careminster' into careminster-presence-refactor

avinationmerge
Melanie 2010-05-08 14:17:43 +01:00
commit 420dd78fb7
4 changed files with 40 additions and 28 deletions

View File

@ -56,7 +56,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
// protected string m_movementAnimation = "DEFAULT"; //KF: 'DEFAULT' does not exist! // protected string m_movementAnimation = "DEFAULT"; //KF: 'DEFAULT' does not exist!
protected string m_movementAnimation = "CROUCH"; //KF: CROUCH ensures reliable Av Anim. init. protected string m_movementAnimation = "CROUCH"; //KF: CROUCH ensures reliable Av Anim. init.
private int m_animTickFall; private int m_animTickFall;
private int m_animTickJump; // private int m_animTickJump;
public int m_animTickJump; // ScenePresence has to see this to control +Z force
/// <value> /// <value>
/// The scene presence that this animator applies to /// The scene presence that this animator applies to
@ -123,22 +124,15 @@ namespace OpenSim.Region.Framework.Scenes.Animation
/// </summary> /// </summary>
public void TrySetMovementAnimation(string anim) public void TrySetMovementAnimation(string anim)
{ {
//Console.WriteLine("Updating movement animation to {0}", anim);
if (!m_scenePresence.IsChildAgent) if (!m_scenePresence.IsChildAgent)
{ {
if (m_animations.TrySetDefaultAnimation( if (m_animations.TrySetDefaultAnimation(
anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID))
{ {
//Console.WriteLine("TSMA {0} success.", anim);
// 16384 is CHANGED_ANIMATION // 16384 is CHANGED_ANIMATION
m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { 16384 }); m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { 16384 });
SendAnimPack(); SendAnimPack();
} }
else
{
//Console.WriteLine("TSMA {0} fail.", anim);
}
} }
} }
@ -267,7 +261,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
m_animTickJump = Environment.TickCount; m_animTickJump = Environment.TickCount;
return "PREJUMP"; return "PREJUMP";
} }
else if (Environment.TickCount - m_animTickJump > PREJUMP_DELAY * 1000.0f) else if (Environment.TickCount - m_animTickJump > PREJUMP_DELAY * 800.0f)
{ {
// Start actual jump // Start actual jump
if (m_animTickJump == -1) if (m_animTickJump == -1)
@ -317,7 +311,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation
public void UpdateMovementAnimations() public void UpdateMovementAnimations()
{ {
m_movementAnimation = GetMovementAnimation(); m_movementAnimation = GetMovementAnimation();
//Console.WriteLine("UMA got {0}", m_movementAnimation);
if (m_movementAnimation == "PREJUMP" && !m_scenePresence.Scene.m_usePreJump) if (m_movementAnimation == "PREJUMP" && !m_scenePresence.Scene.m_usePreJump)
{ {
// This was the previous behavior before PREJUMP // This was the previous behavior before PREJUMP

View File

@ -727,7 +727,7 @@ namespace OpenSim.Region.Framework.Scenes
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
// TODO: Change default to true once the feature is supported // TODO: Change default to true once the feature is supported
m_usePreJump = startupConfig.GetBoolean("enableprejump", false); m_usePreJump = startupConfig.GetBoolean("enableprejump", false);
m_usePreJump = true; // Above line fails!?
m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
if (RegionInfo.NonphysPrimMax > 0) if (RegionInfo.NonphysPrimMax > 0)
{ {

View File

@ -1468,7 +1468,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
i++; i++;
} }
//Paupaw:Do Proper PID for Autopilot here //Paupaw:Do Proper PID for Autopilot here
if (bResetMoveToPosition) if (bResetMoveToPosition)
{ {
@ -2447,10 +2446,11 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
Rotation = rotation; Rotation = rotation;
Vector3 direc = vec * rotation; Vector3 direc = vec * rotation;
direc.Normalize(); direc.Normalize();
PhysicsActor actor = m_physicsActor;
if ((vec.Z == 0f) && !actor.Flying) direc.Z = 0f; // Prevent camera WASD up.
direc *= 0.03f * 128f * m_speedModifier; direc *= 0.03f * 128f * m_speedModifier;
PhysicsActor actor = m_physicsActor;
if (actor != null) if (actor != null)
{ {
if (actor.Flying) if (actor.Flying)
@ -2472,11 +2472,18 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
{ {
if (direc.Z > 2.0f) if (direc.Z > 2.0f)
{ {
direc.Z *= 3.0f; if(m_animator.m_animTickJump == -1)
{
// TODO: PreJump and jump happen too quickly. Many times prejump gets ignored. direc.Z *= 3.0f; // jump
Animator.TrySetMovementAnimation("PREJUMP"); }
Animator.TrySetMovementAnimation("JUMP"); else
{
direc.Z *= 0.1f; // prejump
}
/* Animations are controlled via GetMovementAnimation() in ScenePresenceAnimator.cs
Animator.TrySetMovementAnimation("PREJUMP");
Animator.TrySetMovementAnimation("JUMP");
*/
} }
} }
} }

View File

@ -972,8 +972,17 @@ namespace OpenSim.Region.Physics.OdePlugin
// Prim to avatar collisions // Prim to avatar collisions
d.Vector3 pos = d.BodyGetPosition(Body); d.Vector3 pos = d.BodyGetPosition(Body);
vec.X = (_target_velocity.X - vel.X) * (PID_D) + (_zeroPosition.X - pos.X) * (PID_P * 2); float errX = _zeroPosition.X - pos.X;
vec.Y = (_target_velocity.Y - vel.Y)*(PID_D) + (_zeroPosition.Y - pos.Y)* (PID_P * 2); float errY = _zeroPosition.Y - pos.Y;
if( (Math.Abs(errX) > 0.1f) || (Math.Abs(errY) > 0.1f) )
{
vec.X = (_target_velocity.X - vel.X) * (PID_D) + (errX) * (PID_P * 2);
vec.Y = (_target_velocity.Y - vel.Y) * (PID_D) + (errY) * (PID_P * 2);
}
else
{ // close, jump to lateral destination
d.BodySetPosition(Body, _zeroPosition.X, _zeroPosition.Y, pos.Z);
}
if (flying) if (flying)
{ {
vec.Z = (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P; vec.Z = (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P;
@ -1056,11 +1065,14 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
if (vec.IsFinite()) if (vec.IsFinite())
{ {
doForce(vec); if (!vec.ApproxEquals(Vector3.Zero, 0.01f))
if (!_zeroFlag) {
{ doForce(vec);
AlignAvatarTiltWithCurrentDirectionOfMovement(vec); if (!_zeroFlag)
} {
AlignAvatarTiltWithCurrentDirectionOfMovement(vec);
}
}
} }
else else
{ {