From c155099faf9db4a8dd438be2ddd8a2272b85477a Mon Sep 17 00:00:00 2001
From: Teravus Ovares (Dan Olivares)
Date: Sun, 22 Nov 2009 19:26:00 -0500
Subject: * The client prevents the avatar from landing if the avatar is going
above an unknown certain speed, so, add a speed check on the server. * This
addresses the 'hump the prim' animation playing while you're moving forward
full speed and pressing page down over a prim to land.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 0d1133f..d23d303 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -152,6 +152,8 @@ namespace OpenSim.Region.Framework.Scenes
private Quaternion m_bodyRot= Quaternion.Identity;
+ private const int LAND_VELOCITYMAG_MAX = 12;
+
public bool IsRestrictedToRegion;
public string JID = String.Empty;
@@ -978,8 +980,8 @@ namespace OpenSim.Region.Framework.Scenes
public void StopFlying()
{
// It turns out to get the agent to stop flying, you have to feed it stop flying velocities
- // and send a full object update.
- // There's no message to send the client to tell it to stop flying
+ // There's no explicit message to send the client to tell it to stop flying.. it relies on the
+ // velocity, collision plane and avatar height
// Add 1/6 the avatar's height to it's position so it doesn't shoot into the air
// when the avatar stands up
@@ -993,8 +995,6 @@ namespace OpenSim.Region.Framework.Scenes
AbsolutePosition = AbsolutePosition + new Vector3(0f, 0f, (1.56f / 6f));
}
- Animator.TrySetMovementAnimation("LAND");
- //SendFullUpdateToAllClients();
ControllingClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
AbsolutePosition, Velocity, Vector3.Zero, m_bodyRot, new Vector4(0,0,1,AbsolutePosition.Z - 0.5f), m_uuid, null, GetUpdatePriority(ControllingClient)));
}
@@ -1431,6 +1431,8 @@ namespace OpenSim.Region.Framework.Scenes
// Only do this if we're flying
if (m_physicsActor != null && m_physicsActor.Flying && !m_forceFly)
{
+ // Landing detection code
+
// Are the landing controls requirements filled?
bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) ||
((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
@@ -1440,7 +1442,10 @@ namespace OpenSim.Region.Framework.Scenes
if (m_physicsActor.Flying && colliding && controlland)
{
- StopFlying();
+ // nesting this check because LengthSquared() is expensive and we don't
+ // want to do it every step when flying.
+ if ((Velocity.LengthSquared() <= LAND_VELOCITYMAG_MAX))
+ StopFlying();
}
}
--
cgit v1.1
From 0ff3c28f903f38f5bbc681c9ba9f810ae25dbd8f Mon Sep 17 00:00:00 2001
From: Teravus Ovares (Dan Olivares)
Date: Sun, 22 Nov 2009 20:21:33 -0500
Subject: * This doesn't fix mantis 3522, but it should mitigate it. * If the
start position is outside of the region on the X and Y, put the user in the
center of the region and then damp the Z position at 720 if necessary. If
the start position is not outside of the region on the X or Y, then don't
check the Z.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 43 ++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index a430b1e..f444e51 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3470,6 +3470,49 @@ namespace OpenSim.Region.Framework.Scenes
agent.startpos.Y = crossedBorder.BorderLine.Z - 1;
}
+ //Mitigate http://opensimulator.org/mantis/view.php?id=3522
+ // Check if start position is outside of region
+ // If it is, check the Z start position also.. if not, leave it alone.
+ if (BordersLocked)
+ {
+ lock (EastBorders)
+ {
+ if (agent.startpos.X > EastBorders[0].BorderLine.Z)
+ {
+ m_log.Warn("FIX AGENT POSITION");
+ agent.startpos.X = EastBorders[0].BorderLine.Z * 0.5f;
+ if (agent.startpos.Z > 720)
+ agent.startpos.Z = 720;
+ }
+ }
+ lock (NorthBorders)
+ {
+ if (agent.startpos.Y > NorthBorders[0].BorderLine.Z)
+ {
+ m_log.Warn("FIX Agent POSITION");
+ agent.startpos.Y = NorthBorders[0].BorderLine.Z * 0.5f;
+ if (agent.startpos.Z > 720)
+ agent.startpos.Z = 720;
+ }
+ }
+ }
+ else
+ {
+ if (agent.startpos.X > EastBorders[0].BorderLine.Z)
+ {
+ m_log.Warn("FIX AGENT POSITION");
+ agent.startpos.X = EastBorders[0].BorderLine.Z * 0.5f;
+ if (agent.startpos.Z > 720)
+ agent.startpos.Z = 720;
+ }
+ if (agent.startpos.Y > NorthBorders[0].BorderLine.Z)
+ {
+ m_log.Warn("FIX Agent POSITION");
+ agent.startpos.Y = NorthBorders[0].BorderLine.Z * 0.5f;
+ if (agent.startpos.Z > 720)
+ agent.startpos.Z = 720;
+ }
+ }
// Honor parcel landing type and position.
ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
if (land != null)
--
cgit v1.1
From 9f5c2acd128828d220bf7e47bd4fe13d7a2a910b Mon Sep 17 00:00:00 2001
From: Jeff Ames
Date: Mon, 23 Nov 2009 11:26:06 +0900
Subject: Formatting cleanup.
---
.../Scenes/Animation/ScenePresenceAnimator.cs | 22 +++++++++++-----------
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 10 +++++-----
.../Framework/Scenes/Tests/UuidGathererTests.cs | 4 ++--
3 files changed, 18 insertions(+), 18 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index cbe4118..2e4c260 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -39,7 +39,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
/// Handle all animation duties for a scene presence
///
public class ScenePresenceAnimator
- {
+ {
public AnimationSet Animations
{
get { return m_animations; }
@@ -53,19 +53,19 @@ namespace OpenSim.Region.Framework.Scenes.Animation
{
get { return m_movementAnimation; }
}
- protected string m_movementAnimation = "DEFAULT";
+ protected string m_movementAnimation = "DEFAULT";
private int m_animTickFall;
- private int m_animTickJump;
+ private int m_animTickJump;
///
/// The scene presence that this animator applies to
///
- protected ScenePresence m_scenePresence;
+ protected ScenePresence m_scenePresence;
public ScenePresenceAnimator(ScenePresence sp)
{
- m_scenePresence = sp;
+ m_scenePresence = sp;
}
public void AddAnimation(UUID animID, UUID objectID)
@@ -110,11 +110,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation
return;
RemoveAnimation(animID);
- }
+ }
public void ResetAnimations()
{
- m_animations.Clear();
+ m_animations.Clear();
}
///
@@ -131,7 +131,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero))
{
// 16384 is CHANGED_ANIMATION
- m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { 16384 });
+ m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { 16384 });
SendAnimPack();
}
}
@@ -305,7 +305,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
#endregion Ground Movement
return m_movementAnimation;
- }
+ }
///
/// Update the movement animation of this avatar according to its current state
@@ -391,7 +391,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
m_scenePresence.Scene.AssetService.Store(Animasset);
AddAnimation(Animasset.FullID, m_scenePresence.UUID);
return anim;
- }
+ }
///
///
@@ -443,6 +443,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation
m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs);
SendAnimPack(animIDs, sequenceNums, objectIDs);
- }
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index d23d303..5604e3d 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -247,7 +247,7 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Script engines present in the scene
///
- private IScriptModule[] m_scriptEngines;
+ private IScriptModule[] m_scriptEngines;
#region Properties
@@ -674,7 +674,7 @@ namespace OpenSim.Region.Framework.Scenes
AvatarWearable[] wearables)
: this(client, world, reginfo)
{
- m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams);
+ m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams);
}
public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance)
@@ -3052,7 +3052,7 @@ namespace OpenSim.Region.Framework.Scenes
public ScenePresence()
{
- m_sendCourseLocationsMethod = SendCoarseLocationsDefault;
+ m_sendCourseLocationsMethod = SendCoarseLocationsDefault;
CreateSceneViewer();
m_animator = new ScenePresenceAnimator(this);
}
@@ -3140,8 +3140,8 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
- }
- }
+ }
+ }
public bool CrossAttachmentsIntoNewRegion(ulong regionHandle, bool silent)
{
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
index b68a044..a36c4db 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
m_uuidGatherer.GatherAssetUuids(corruptAssetUuid, AssetType.Object, foundAssetUuids);
// We count the uuid as gathered even if the asset itself is corrupt.
- Assert.That(foundAssetUuids.Count, Is.EqualTo(1));
+ Assert.That(foundAssetUuids.Count, Is.EqualTo(1));
}
///
@@ -76,7 +76,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
{
TestHelper.InMethod();
- UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
+ UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
IDictionary foundAssetUuids = new Dictionary();
m_uuidGatherer.GatherAssetUuids(missingAssetUuid, AssetType.Object, foundAssetUuids);
--
cgit v1.1