diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index a7238fd6af..5d7bdd4780 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -184,6 +184,7 @@ namespace OpenSim.Framework public delegate void DisconnectUser(); public delegate void RequestAvatarProperties(IClientAPI remoteClient, LLUUID avatarID); + public delegate void SetAlwaysRun (IClientAPI remoteClient, bool SetAlwaysRun); public delegate void GenericCall2(); @@ -293,7 +294,7 @@ namespace OpenSim.Framework event TeleportLocationRequest OnTeleportLocationRequest; event DisconnectUser OnDisconnectUser; event RequestAvatarProperties OnRequestAvatarProperties; - + event SetAlwaysRun OnSetAlwaysRun; event GenericCall4 OnDeRezObject; event Action OnRegionHandShakeReply; event GenericCall2 OnRequestWearables; diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index b52a8344b8..b18a84455b 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -84,6 +84,7 @@ namespace OpenSim.Region.ClientStack public event TeleportLocationRequest OnTeleportLocationRequest; public event DisconnectUser OnDisconnectUser; public event RequestAvatarProperties OnRequestAvatarProperties; + public event SetAlwaysRun OnSetAlwaysRun; public event CreateNewInventoryItem OnCreateNewInventoryItem; public event CreateInventoryFolder OnCreateNewInventoryFolder; diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 978f34e7c7..f941d6cafe 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -168,6 +168,13 @@ namespace OpenSim.Region.ClientStack { OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam); } + break; + case PacketType.SetAlwaysRun: + SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack; + + if (OnSetAlwaysRun != null) + OnSetAlwaysRun(this,run.AgentData.AlwaysRun); + break; case PacketType.CompleteAgentMovement: if (OnCompleteMovementToRegion != null) diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 5d643d148c..307dec7db5 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -55,6 +55,7 @@ namespace OpenSim.Region.Environment.Scenes private bool m_oldColliding = true; private bool m_isTyping = false; + private bool m_setAlwaysRun = false; private Quaternion m_bodyRot; private byte[] m_visualParams; @@ -271,6 +272,7 @@ namespace OpenSim.Region.Environment.Scenes m_controllingClient.OnAgentUpdate += HandleAgentUpdate; m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit; m_controllingClient.OnAgentSit += HandleAgentSit; + m_controllingClient.OnSetAlwaysRun += HandleSetAlwaysRun; // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); @@ -637,7 +639,15 @@ namespace OpenSim.Region.Environment.Scenes SendAnimPack(Animations.AnimsLLUUID["SIT"], 1); SendFullUpdateToAllClients(); } + public void HandleSetAlwaysRun(IClientAPI remoteClient, bool SetAlwaysRun) + { + m_setAlwaysRun = SetAlwaysRun; + if (PhysicsActor != null) + { + PhysicsActor.SetAlwaysRun = SetAlwaysRun; + } + } protected void UpdateMovementAnimations(bool update_movementflag) { if (update_movementflag) @@ -667,7 +677,14 @@ namespace OpenSim.Region.Environment.Scenes } else { - SendAnimPack(Animations.AnimsLLUUID["WALK"], 1); + if (!m_setAlwaysRun) + { + SendAnimPack(Animations.AnimsLLUUID["WALK"], 1); + } + else + { + SendAnimPack(Animations.AnimsLLUUID["RUN"], 1); + } } } } diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 717b6c0860..474f6fd80e 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs @@ -61,6 +61,7 @@ namespace SimpleApp public event TeleportLocationRequest OnTeleportLocationRequest; public event DisconnectUser OnDisconnectUser; public event RequestAvatarProperties OnRequestAvatarProperties; + public event SetAlwaysRun OnSetAlwaysRun; public event GenericCall4 OnDeRezObject; public event Action OnRegionHandShakeReply; diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index 3283ec0430..25820970a6 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs @@ -206,6 +206,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin get { return m_rotationalVelocity; } set { m_rotationalVelocity = value; } } + public override bool SetAlwaysRun + { + get { return false; } + set { return; } + } public override bool IsPhysical { get { return false; } diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index b51f0243fe..f78e99e847 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs @@ -764,7 +764,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin return; } } - + public override bool SetAlwaysRun + { + get { return false; } + set { return; } + } public override PhysicsVector Acceleration { get { return _acceleration; } diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 49760dad28..84b451f348 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -153,7 +153,7 @@ namespace OpenSim.Region.Physics.Manager public abstract bool IsPhysical {get; set;} public abstract bool Flying { get; set; } - + public abstract bool SetAlwaysRun { get; set; } public abstract bool ThrottleUpdates { get; set; } public abstract bool IsColliding { get; set; } @@ -176,6 +176,11 @@ namespace OpenSim.Region.Physics.Manager get { return PhysicsVector.Zero; } set { return; } } + public override bool SetAlwaysRun + { + get { return false; } + set { return; } + } public override bool CollidingGround { get {return false;} diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index c93b96fe34..b528b9b6a2 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -660,6 +660,7 @@ namespace OpenSim.Region.Physics.OdePlugin private bool flying = false; private bool m_iscolliding = false; private bool m_wascolliding = false; + private bool m_alwaysRun = false; private bool[] m_colliderarr = new bool[11]; @@ -702,6 +703,11 @@ namespace OpenSim.Region.Physics.OdePlugin get { return (int)ActorTypes.Agent; } set { return; } } + public override bool SetAlwaysRun + { + get { return m_alwaysRun; } + set { m_alwaysRun = value;} + } public override bool IsPhysical { get { return false; } @@ -876,6 +882,17 @@ namespace OpenSim.Region.Physics.OdePlugin // no lock; for now it's only called from within Simulate() PhysicsVector vec = new PhysicsVector(); d.Vector3 vel = d.BodyGetLinearVel(Body); + float movementdivisor = 1f; + + if (!m_alwaysRun) + { + movementdivisor = 10.5f; + } + else + { + movementdivisor = 0.2079f; + + } // if velocity is zero, use position control; otherwise, velocity control if (_target_velocity.X == 0.0f && _target_velocity.Y == 0.0f && _target_velocity.Z == 0.0f && m_iscolliding) @@ -900,8 +917,9 @@ namespace OpenSim.Region.Physics.OdePlugin _zeroFlag = false; if (m_iscolliding || flying) { - vec.X = (_target_velocity.X - vel.X) * PID_D; - vec.Y = (_target_velocity.Y - vel.Y) * PID_D; + + vec.X = ((_target_velocity.X - vel.X)/movementdivisor) * PID_D; + vec.Y = ((_target_velocity.Y - vel.Y)/movementdivisor) * PID_D; } if (m_iscolliding && !flying && _target_velocity.Z > 0.0f) { @@ -1077,6 +1095,11 @@ namespace OpenSim.Region.Physics.OdePlugin get { return (int)ActorTypes.Prim; } set { return; } } + public override bool SetAlwaysRun + { + get { return false; } + set { return; } + } public void enableBody() { // Sets the geom to a body diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index 1396458250..4805d79a5d 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs @@ -209,6 +209,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin get { return (int)ActorTypes.Agent; } set { return; } } + public override bool SetAlwaysRun + { + get { return false; } + set { return; } + } public override bool IsPhysical { get { return false; } @@ -363,6 +368,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin get { return false; } set { return; } } + public override bool SetAlwaysRun + { + get { return false; } + set { return; } + } public override bool ThrottleUpdates { get { return false; } diff --git a/bin/data/avataranimations.xml b/bin/data/avataranimations.xml index ac769e296d..e894283ec6 100644 --- a/bin/data/avataranimations.xml +++ b/bin/data/avataranimations.xml @@ -14,4 +14,5 @@ c541c47f-e0c0-058b-ad1a-d6ae3a4584d9 666307d9-a860-572d-6fd4-c3ab8865c094 2305bd75-1ca9-b03b-1faa-b176b8a8c49e + 05ddbff8-aaa9-92a1-2b74-8fe77a29b445