* Implemented Walk Vs Run in ODE. Also helps make the walk look smoother.
* All thanks to unimplemented packet listing :Dafrisby
parent
5952441fcc
commit
d9d35f9fd7
|
@ -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<IClientAPI> OnRegionHandShakeReply;
|
||||
event GenericCall2 OnRequestWearables;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<IClientAPI> OnRegionHandShakeReply;
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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;}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -14,4 +14,5 @@
|
|||
<animation name="TYPE">c541c47f-e0c0-058b-ad1a-d6ae3a4584d9</animation>
|
||||
<animation name="FALLDOWN">666307d9-a860-572d-6fd4-c3ab8865c094</animation>
|
||||
<animation name="JUMP">2305bd75-1ca9-b03b-1faa-b176b8a8c49e</animation>
|
||||
<animation name="RUN">05ddbff8-aaa9-92a1-2b74-8fe77a29b445</animation>
|
||||
</animations>
|
||||
|
|
Loading…
Reference in New Issue