diff options
author | Melanie | 2011-11-05 21:41:16 +0000 |
---|---|---|
committer | Melanie | 2011-11-05 21:41:16 +0000 |
commit | 2dc452b4a71be8359a7ff66b52c9bfc62d0c12ac (patch) | |
tree | 3c2a570b2196fbc2d11a9c66939a70a280f9424d /OpenSim/Region | |
parent | Chnaging the sit target adjustment to a more precise approximation of SL. Som... (diff) | |
download | opensim-SC_OLD-2dc452b4a71be8359a7ff66b52c9bfc62d0c12ac.zip opensim-SC_OLD-2dc452b4a71be8359a7ff66b52c9bfc62d0c12ac.tar.gz opensim-SC_OLD-2dc452b4a71be8359a7ff66b52c9bfc62d0c12ac.tar.bz2 opensim-SC_OLD-2dc452b4a71be8359a7ff66b52c9bfc62d0c12ac.tar.xz |
ScenePresence part of the Avination animator fixes.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 61 |
1 files changed, 58 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1809b84..f0776a9 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Xml; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Timers; | 32 | using System.Timers; |
@@ -137,6 +138,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
137 | //private int m_lastTerseSent; | 138 | //private int m_lastTerseSent; |
138 | 139 | ||
139 | private Vector3? m_forceToApply; | 140 | private Vector3? m_forceToApply; |
141 | private int m_userFlags; | ||
142 | public int UserFlags | ||
143 | { | ||
144 | get { return m_userFlags; } | ||
145 | } | ||
146 | private bool m_flyingOld; // add for fly velocity control | ||
147 | public bool m_wasFlying; // add for fly velocity control | ||
148 | |||
149 | private int m_lastColCount = -1; //KF: Look for Collision chnages | ||
150 | private int m_updateCount = 0; //KF: Update Anims for a while | ||
151 | private static readonly int UPDATE_COUNT = 10; // how many frames to update for | ||
152 | |||
140 | private TeleportFlags m_teleportFlags; | 153 | private TeleportFlags m_teleportFlags; |
141 | public TeleportFlags TeleportFlags | 154 | public TeleportFlags TeleportFlags |
142 | { | 155 | { |
@@ -756,6 +769,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
756 | m_localId = m_scene.AllocateLocalId(); | 769 | m_localId = m_scene.AllocateLocalId(); |
757 | 770 | ||
758 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); | 771 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); |
772 | m_userFlags = account.UserFlags; | ||
759 | 773 | ||
760 | if (account != null) | 774 | if (account != null) |
761 | UserLevel = account.UserLevel; | 775 | UserLevel = account.UserLevel; |
@@ -1033,7 +1047,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1033 | /// <summary> | 1047 | /// <summary> |
1034 | /// Removes physics plugin scene representation of this agent if it exists. | 1048 | /// Removes physics plugin scene representation of this agent if it exists. |
1035 | /// </summary> | 1049 | /// </summary> |
1036 | private void RemoveFromPhysicalScene() | 1050 | public void RemoveFromPhysicalScene() |
1037 | { | 1051 | { |
1038 | if (PhysicsActor != null) | 1052 | if (PhysicsActor != null) |
1039 | { | 1053 | { |
@@ -1362,6 +1376,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1362 | 1376 | ||
1363 | #endregion Inputs | 1377 | #endregion Inputs |
1364 | 1378 | ||
1379 | // Make anims work for client side autopilot | ||
1380 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0) | ||
1381 | m_updateCount = UPDATE_COUNT; | ||
1382 | |||
1365 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) | 1383 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) |
1366 | { | 1384 | { |
1367 | StandUp(); | 1385 | StandUp(); |
@@ -1392,6 +1410,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1392 | 1410 | ||
1393 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0) | 1411 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0) |
1394 | { | 1412 | { |
1413 | m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick. | ||
1414 | Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); | ||
1415 | |||
1395 | // TODO: This doesn't prevent the user from walking yet. | 1416 | // TODO: This doesn't prevent the user from walking yet. |
1396 | // Setting parent ID would fix this, if we knew what value | 1417 | // Setting parent ID would fix this, if we knew what value |
1397 | // to use. Or we could add a m_isSitting variable. | 1418 | // to use. Or we could add a m_isSitting variable. |
@@ -1726,6 +1747,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1726 | /// </param> | 1747 | /// </param> |
1727 | public void MoveToTarget(Vector3 pos, bool noFly, bool landAtTarget) | 1748 | public void MoveToTarget(Vector3 pos, bool noFly, bool landAtTarget) |
1728 | { | 1749 | { |
1750 | if (SitGround) | ||
1751 | StandUp(); | ||
1752 | |||
1729 | m_log.DebugFormat( | 1753 | m_log.DebugFormat( |
1730 | "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", | 1754 | "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", |
1731 | Name, pos, m_scene.RegionInfo.RegionName); | 1755 | Name, pos, m_scene.RegionInfo.RegionName); |
@@ -2361,6 +2385,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
2361 | Vector3 direc = vec * Rotation; | 2385 | Vector3 direc = vec * Rotation; |
2362 | direc.Normalize(); | 2386 | direc.Normalize(); |
2363 | 2387 | ||
2388 | if (PhysicsActor.Flying != m_flyingOld) // add for fly velocity control | ||
2389 | { | ||
2390 | m_flyingOld = PhysicsActor.Flying; // add for fly velocity control | ||
2391 | if (!PhysicsActor.Flying) | ||
2392 | m_wasFlying = true; // add for fly velocity control | ||
2393 | } | ||
2394 | |||
2395 | if (PhysicsActor.IsColliding == true) | ||
2396 | m_wasFlying = false; // add for fly velocity control | ||
2397 | |||
2398 | if ((vec.Z == 0f) && !PhysicsActor.Flying) | ||
2399 | direc.Z = 0f; // Prevent camera WASD up. | ||
2400 | |||
2364 | direc *= 0.03f * 128f * SpeedModifier; | 2401 | direc *= 0.03f * 128f * SpeedModifier; |
2365 | 2402 | ||
2366 | if (PhysicsActor != null) | 2403 | if (PhysicsActor != null) |
@@ -2379,7 +2416,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2379 | // m_log.Info("[AGENT]: Stop Flying"); | 2416 | // m_log.Info("[AGENT]: Stop Flying"); |
2380 | //} | 2417 | //} |
2381 | } | 2418 | } |
2382 | else if (!PhysicsActor.Flying && PhysicsActor.IsColliding) | 2419 | if (!PhysicsActor.Flying && PhysicsActor.IsColliding) |
2383 | { | 2420 | { |
2384 | if (direc.Z > 2.0f) | 2421 | if (direc.Z > 2.0f) |
2385 | { | 2422 | { |
@@ -3303,13 +3340,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
3303 | // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( | 3340 | // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( |
3304 | // as of this comment the interval is set in AddToPhysicalScene | 3341 | // as of this comment the interval is set in AddToPhysicalScene |
3305 | if (Animator != null) | 3342 | if (Animator != null) |
3306 | Animator.UpdateMovementAnimations(); | 3343 | { |
3344 | if (m_updateCount > 0) | ||
3345 | { | ||
3346 | Animator.UpdateMovementAnimations(); | ||
3347 | m_updateCount--; | ||
3348 | } | ||
3349 | } | ||
3307 | 3350 | ||
3308 | CollisionEventUpdate collisionData = (CollisionEventUpdate)e; | 3351 | CollisionEventUpdate collisionData = (CollisionEventUpdate)e; |
3309 | Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; | 3352 | Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; |
3310 | 3353 | ||
3311 | CollisionPlane = Vector4.UnitW; | 3354 | CollisionPlane = Vector4.UnitW; |
3312 | 3355 | ||
3356 | // No collisions at all means we may be flying. Update always | ||
3357 | // to make falling work | ||
3358 | if (m_lastColCount != coldata.Count || coldata.Count == 0) | ||
3359 | { | ||
3360 | m_updateCount = UPDATE_COUNT; | ||
3361 | m_lastColCount = coldata.Count; | ||
3362 | } | ||
3363 | |||
3313 | if (coldata.Count != 0 && Animator != null) | 3364 | if (coldata.Count != 0 && Animator != null) |
3314 | { | 3365 | { |
3315 | switch (Animator.CurrentMovementAnimation) | 3366 | switch (Animator.CurrentMovementAnimation) |
@@ -3410,6 +3461,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3410 | { | 3461 | { |
3411 | lock (m_attachments) | 3462 | lock (m_attachments) |
3412 | { | 3463 | { |
3464 | // This may be true when the attachment comes back | ||
3465 | // from serialization after login. Clear it. | ||
3466 | gobj.IsDeleted = false; | ||
3467 | |||
3413 | m_attachments.Add(gobj); | 3468 | m_attachments.Add(gobj); |
3414 | } | 3469 | } |
3415 | } | 3470 | } |