aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-11-29 00:12:11 +0000
committerJustin Clark-Casey (justincc)2014-11-29 00:12:11 +0000
commit265fe349e00b3ece59ec02e56f83bb7623e9d962 (patch)
tree42afe816271f54a017fe5f731d905e923ef5d67b /OpenSim/Region/Framework
parentAvoid repeated lag-generating continuous attempts to retrieve HG service Urls... (diff)
downloadopensim-SC_OLD-265fe349e00b3ece59ec02e56f83bb7623e9d962.zip
opensim-SC_OLD-265fe349e00b3ece59ec02e56f83bb7623e9d962.tar.gz
opensim-SC_OLD-265fe349e00b3ece59ec02e56f83bb7623e9d962.tar.bz2
opensim-SC_OLD-265fe349e00b3ece59ec02e56f83bb7623e9d962.tar.xz
Somewhat improve avatar region crossings by properly preserving velocity when avatar enters the new region.
This commit addresses the following issues were causing velocity to be set to 0 on the new region, disrupting flight in particular * Full avatar updates contained no velocity information, which does appear to have some effect in testing. * BulletSim was always setting the velocity to 0 for the new BSCharacter. Now, physics engines take a velocity parameter when setting up characters so we can avoid this. This patch applies to both Bullet and ODE.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs44
1 files changed, 24 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 5a35aff..966152a 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -636,6 +636,11 @@ namespace OpenSim.Region.Framework.Scenes
636 636
637 set 637 set
638 { 638 {
639// Util.PrintCallStack();
640// m_log.DebugFormat(
641// "[SCENE PRESENCE]: In {0} set velocity of {1} to {2}",
642// Scene.RegionInfo.RegionName, Name, value);
643
639 if (PhysicsActor != null) 644 if (PhysicsActor != null)
640 { 645 {
641 try 646 try
@@ -648,11 +653,7 @@ namespace OpenSim.Region.Framework.Scenes
648 } 653 }
649 } 654 }
650 655
651 m_velocity = value; 656 m_velocity = value;
652
653// m_log.DebugFormat(
654// "[SCENE PRESENCE]: In {0} set velocity of {1} to {2}",
655// Scene.RegionInfo.RegionName, Name, m_velocity);
656 } 657 }
657 } 658 }
658/* 659/*
@@ -1185,15 +1186,23 @@ namespace OpenSim.Region.Framework.Scenes
1185 } 1186 }
1186 AbsolutePosition = pos; 1187 AbsolutePosition = pos;
1187 1188
1189// m_log.DebugFormat(
1190// "Set pos {0}, vel {1} in {1} to {2} from input position of {3} on MakeRootAgent",
1191// Name, Scene.Name, AbsolutePosition, pos);
1192//
1188 if (m_teleportFlags == TeleportFlags.Default) 1193 if (m_teleportFlags == TeleportFlags.Default)
1189 { 1194 {
1190 Vector3 vel = Velocity;
1191 AddToPhysicalScene(isFlying); 1195 AddToPhysicalScene(isFlying);
1192 if (PhysicsActor != null) 1196//
1193 PhysicsActor.SetMomentum(vel); 1197// Console.WriteLine(
1198// "Set velocity of {0} in {1} to {2} from input velocity of {3} on MakeRootAgent",
1199// Name, Scene.Name, PhysicsActor.Velocity, vel);
1200// }
1194 } 1201 }
1195 else 1202 else
1203 {
1196 AddToPhysicalScene(isFlying); 1204 AddToPhysicalScene(isFlying);
1205 }
1197 1206
1198 // XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a 1207 // XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a
1199 // location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it 1208 // location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it
@@ -1211,6 +1220,7 @@ namespace OpenSim.Region.Framework.Scenes
1211 Flying = false; 1220 Flying = false;
1212 } 1221 }
1213 } 1222 }
1223
1214 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying 1224 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying
1215 // avatar to return to the standing position in mid-air. On login it looks like this is being sent 1225 // avatar to return to the standing position in mid-air. On login it looks like this is being sent
1216 // elsewhere anyway 1226 // elsewhere anyway
@@ -1275,7 +1285,6 @@ namespace OpenSim.Region.Framework.Scenes
1275 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will 1285 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will
1276 // stall on the border crossing since the existing child agent will still have the last movement 1286 // stall on the border crossing since the existing child agent will still have the last movement
1277 // recorded, which stops the input from being processed. 1287 // recorded, which stops the input from being processed.
1278
1279 MovementFlag = 0; 1288 MovementFlag = 0;
1280 1289
1281 m_scene.EventManager.TriggerOnMakeRootAgent(this); 1290 m_scene.EventManager.TriggerOnMakeRootAgent(this);
@@ -3668,10 +3677,7 @@ namespace OpenSim.Region.Framework.Scenes
3668 // Compute the avatar position in the next physics tick. 3677 // Compute the avatar position in the next physics tick.
3669 // If the avatar will be crossing, we force the crossing to happen now 3678 // If the avatar will be crossing, we force the crossing to happen now
3670 // in the hope that this will make the avatar movement smoother when crossing. 3679 // in the hope that this will make the avatar movement smoother when crossing.
3671 float timeStep = 0.1f; 3680 pos2 += vel * 0.1f;
3672 pos2.X = pos2.X + (vel.X * timeStep);
3673 pos2.Y = pos2.Y + (vel.Y * timeStep);
3674 pos2.Z = pos2.Z + (vel.Z * timeStep);
3675 3681
3676 if (m_scene.PositionIsInCurrentRegion(pos2)) 3682 if (m_scene.PositionIsInCurrentRegion(pos2))
3677 return; 3683 return;
@@ -3682,9 +3688,11 @@ namespace OpenSim.Region.Framework.Scenes
3682 // Disconnect from the current region 3688 // Disconnect from the current region
3683 bool isFlying = Flying; 3689 bool isFlying = Flying;
3684 RemoveFromPhysicalScene(); 3690 RemoveFromPhysicalScene();
3691
3685 // pos2 is the forcasted position so make that the 'current' position so the crossing 3692 // pos2 is the forcasted position so make that the 'current' position so the crossing
3686 // code will move us into the newly addressed region. 3693 // code will move us into the newly addressed region.
3687 m_pos = pos2; 3694 m_pos = pos2;
3695
3688 if (CrossToNewRegion()) 3696 if (CrossToNewRegion())
3689 { 3697 {
3690 AddToPhysicalScene(isFlying); 3698 AddToPhysicalScene(isFlying);
@@ -4116,19 +4124,15 @@ namespace OpenSim.Region.Framework.Scenes
4116 if (Appearance.AvatarHeight == 0) 4124 if (Appearance.AvatarHeight == 0)
4117// Appearance.SetHeight(); 4125// Appearance.SetHeight();
4118 Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f)); 4126 Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f));
4119 4127
4120 PhysicsScene scene = m_scene.PhysicsScene;
4121
4122 Vector3 pVec = AbsolutePosition;
4123
4124/* 4128/*
4125 PhysicsActor = scene.AddAvatar( 4129 PhysicsActor = scene.AddAvatar(
4126 LocalId, Firstname + "." + Lastname, pVec, 4130 LocalId, Firstname + "." + Lastname, pVec,
4127 new Vector3(0.45f, 0.6f, Appearance.AvatarHeight), isFlying); 4131 new Vector3(0.45f, 0.6f, Appearance.AvatarHeight), isFlying);
4128*/ 4132*/
4129 4133
4130 PhysicsActor = scene.AddAvatar( 4134 PhysicsActor = m_scene.PhysicsScene.AddAvatar(
4131 LocalId, Firstname + "." + Lastname, pVec, 4135 LocalId, Firstname + "." + Lastname, AbsolutePosition, Velocity,
4132 Appearance.AvatarBoxSize, isFlying); 4136 Appearance.AvatarBoxSize, isFlying);
4133 4137
4134 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 4138 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;