From 9089bc7e37879867756740cfbd0456ad51244ca0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 17 Dec 2012 22:11:29 +0000 Subject: some clean up/fix --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 93 ++++++++++++------------ 1 file changed, 46 insertions(+), 47 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7ff163b..646e0e2 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2082,9 +2082,6 @@ namespace OpenSim.Region.Framework.Scenes if (part == null) return; - // TODO: determine position to sit at based on scene geometry; don't trust offset from client - // see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it - if (PhysicsActor != null) m_sitAvatarHeight = PhysicsActor.Size.Z * 0.5f; @@ -2103,25 +2100,8 @@ namespace OpenSim.Region.Framework.Scenes } else { -// if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10) -// { -// m_log.DebugFormat( -// "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is unset and within 10m", -// Name, part.Name, part.LocalId); - - if (m_scene.PhysicsScene != null && - part.PhysActor != null && - Util.GetDistanceTo(AbsolutePosition, pos) <= 30) - { - - Vector3 camdif = CameraPosition - part.AbsolutePosition; - camdif.Normalize(); - -// m_log.InfoFormat("sit {0} {1}", offset.ToString(), camdif.ToString()); - - if (m_scene.PhysicsScene.SitAvatar(part.PhysActor, AbsolutePosition, CameraPosition, offset, new Vector3(0.35f, 0, 0.65f), PhysicsSitResponse) != 0) - return; - } + if (PhysicsSit(part,offset)) // physics engine + return; if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10) { @@ -2129,12 +2109,6 @@ namespace OpenSim.Region.Framework.Scenes AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight); canSit = true; } -// else -// { -// m_log.DebugFormat( -// "[SCENE PRESENCE]: Ignoring sit request of {0} on {1} {2} because sit target is unset and outside 10m", -// Name, part.Name, part.LocalId); -// } } if (canSit) @@ -2196,14 +2170,6 @@ namespace OpenSim.Region.Framework.Scenes m_requestedSitTargetID = part.LocalId; m_requestedSitTargetUUID = targetID; -// m_log.DebugFormat("[SIT]: Client requested Sit Position: {0}", offset); - - if (m_scene.PhysicsScene.SupportsRayCast()) - { - //m_scene.PhysicsScene.RaycastWorld(Vector3.Zero,Vector3.Zero, 0.01f,new RaycastCallback()); - //SitRayCastAvatarPosition(part); - //return; - } } else { @@ -2213,24 +2179,57 @@ namespace OpenSim.Region.Framework.Scenes SendSitResponse(targetID, offset, Quaternion.Identity); } - public void PhysicsSitResponse(int status, uint partID, Vector3 offset, Quaternion Orientation) + // returns false if does not suport so older sit can be tried + public bool PhysicsSit(SceneObjectPart part, Vector3 offset) { + if (part == null || part.ParentGroup.IsAttachment) + { + return true; + } - if (status < 0) + if ( m_scene.PhysicsScene == null) + return false; + + if (part.PhysActor == null) { - ControllingClient.SendAlertMessage("Sit position no longer exists"); - return; + // none physcis shape + if (part.PhysicsShapeType == (byte)PhysicsShapeType.None) + ControllingClient.SendAlertMessage(" There is no suitable surface to sit on, try another spot."); + else + { // non physical phantom TODO + ControllingClient.SendAlertMessage(" There is no suitable surface to sit on, try another spot."); + return false; + } + return true; } - if (status == 0) + // not doing autopilot + m_requestedSitTargetID = 0; + + if (m_scene.PhysicsScene.SitAvatar(part.PhysActor, AbsolutePosition, CameraPosition, offset, new Vector3(0.35f, 0, 0.65f), PhysicsSitResponse) != 0) + return true; + + return false; + } + + // status + // < 0 ignore + // 0 bad sit spot + public void PhysicsSitResponse(int status, uint partID, Vector3 offset, Quaternion Orientation) + { + if (status < 0) return; - SceneObjectPart part = m_scene.GetSceneObjectPart(partID); - if (part == null || part.ParentGroup.IsAttachment) + if (status == 0) { + ControllingClient.SendAlertMessage(" There is no suitable surface to sit on, try another spot."); return; } + SceneObjectPart part = m_scene.GetSceneObjectPart(partID); + if (part == null) + return; + // m_log.InfoFormat("physsit {0} {1}", offset.ToString(),Orientation.ToString()); part.AddSittingAvatar(UUID); @@ -2242,16 +2241,14 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendSitResponse( part.UUID, offset, Orientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook); - part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); - - // assuming no autopilot in use + // not using autopilot Velocity = Vector3.Zero; RemoveFromPhysicalScene(); Rotation = Orientation; m_pos = offset; - m_requestedSitTargetID = 0; // invalidate the viewer sit comand for now + m_requestedSitTargetID = 0; part.ParentGroup.AddAvatar(UUID); ParentPart = part; @@ -2259,6 +2256,8 @@ namespace OpenSim.Region.Framework.Scenes Animator.TrySetMovementAnimation("SIT"); SendAvatarDataToAllAgents(); + + part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); } -- cgit v1.1 From f9051c22d8170bb2824d9a38540f2fdce4367f6e Mon Sep 17 00:00:00 2001 From: teravus Date: Wed, 19 Dec 2012 22:14:20 -0500 Subject: * Send an Unsolicited AgentDataUpdate packet upon Root Agent Status to synchronize with Agni. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7ff163b..70e7af5 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -925,6 +925,26 @@ namespace OpenSim.Region.Framework.Scenes m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); + UUID groupUUID = UUID.Zero; + string GroupName = string.Empty; + ulong groupPowers = 0; + + // ---------------------------------- + // Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status + if (gm != null) + { + groupUUID = ControllingClient.ActiveGroupId; + GroupRecord record = gm.GetGroupRecord(groupUUID); + if (record != null) + GroupName = record.GroupName; + GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid); + if (groupMembershipData != null) + groupPowers = groupMembershipData.GroupPowers; + } + ControllingClient.SendAgentDataUpdate(m_uuid, groupUUID, Firstname, Lastname, groupPowers, GroupName, + Grouptitle); + // ------------------------------------ + if (ParentID == 0) { // Moved this from SendInitialData to ensure that Appearance is initialized -- cgit v1.1 From 77cc7ce399d1b1a710f3b3f4337932febdef66c8 Mon Sep 17 00:00:00 2001 From: teravus Date: Fri, 21 Dec 2012 19:12:30 -0500 Subject: * Partial Commit for Avatar Appearance to include the functionality of Cached Bakes. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 27 +++++++++++++++--------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 70e7af5..ff9df37 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -931,18 +931,25 @@ namespace OpenSim.Region.Framework.Scenes // ---------------------------------- // Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status - if (gm != null) + try + { + if (gm != null) + { + groupUUID = ControllingClient.ActiveGroupId; + GroupRecord record = gm.GetGroupRecord(groupUUID); + if (record != null) + GroupName = record.GroupName; + GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid); + if (groupMembershipData != null) + groupPowers = groupMembershipData.GroupPowers; + } + ControllingClient.SendAgentDataUpdate(m_uuid, groupUUID, Firstname, Lastname, groupPowers, GroupName, + Grouptitle); + } + catch (Exception e) { - groupUUID = ControllingClient.ActiveGroupId; - GroupRecord record = gm.GetGroupRecord(groupUUID); - if (record != null) - GroupName = record.GroupName; - GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid); - if (groupMembershipData != null) - groupPowers = groupMembershipData.GroupPowers; + m_log.Debug("[AGENTUPDATE]: " + e.ToString()); } - ControllingClient.SendAgentDataUpdate(m_uuid, groupUUID, Firstname, Lastname, groupPowers, GroupName, - Grouptitle); // ------------------------------------ if (ParentID == 0) -- cgit v1.1 From 7980a1d8496b71e46eeead7d77382cd10ac9fa78 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 2 Jan 2013 19:39:46 +0000 Subject: *TEST* avatar unscripted sit. Some guessing/automation --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 85f4ee5..2a39ffd 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2280,8 +2280,10 @@ namespace OpenSim.Region.Framework.Scenes ParentPart = part; ParentID = part.LocalId; - - Animator.TrySetMovementAnimation("SIT"); + if(status == 3) + Animator.TrySetMovementAnimation("SIT_GROUND"); + else + Animator.TrySetMovementAnimation("SIT"); SendAvatarDataToAllAgents(); part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); -- cgit v1.1 From d40cdd26496c267b7de4cf7005eb6c933d7ad238 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 3 Jan 2013 02:25:27 +0000 Subject: cancel MoveToTarget (viewer 'go here") on sits --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2a39ffd..704bad8 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2140,12 +2140,21 @@ namespace OpenSim.Region.Framework.Scenes if (canSit) { + if (PhysicsActor != null) { // We can remove the physicsActor until they stand up. RemoveFromPhysicalScene(); } + if (MovingToTarget) + { + ResetMoveToTarget(); + m_forceToApply = null; + } + + Velocity = Vector3.Zero; + part.AddSittingAvatar(UUID); cameraAtOffset = part.GetCameraAtOffset(); @@ -2230,6 +2239,7 @@ namespace OpenSim.Region.Framework.Scenes return true; } + // not doing autopilot m_requestedSitTargetID = 0; @@ -2259,8 +2269,19 @@ namespace OpenSim.Region.Framework.Scenes // m_log.InfoFormat("physsit {0} {1}", offset.ToString(),Orientation.ToString()); + RemoveFromPhysicalScene(); + + if (MovingToTarget) + { + ResetMoveToTarget(); + m_forceToApply = null; + } + + Velocity = Vector3.Zero; + part.AddSittingAvatar(UUID); + Vector3 cameraAtOffset = part.GetCameraAtOffset(); Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); bool forceMouselook = part.GetForceMouselook(); @@ -2269,8 +2290,6 @@ namespace OpenSim.Region.Framework.Scenes part.UUID, offset, Orientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook); // not using autopilot - Velocity = Vector3.Zero; - RemoveFromPhysicalScene(); Rotation = Orientation; m_pos = offset; @@ -2317,6 +2336,7 @@ namespace OpenSim.Region.Framework.Scenes return; } + if (part.SitTargetAvatar == UUID) { Vector3 sitTargetPos = part.SitTargetPosition; -- cgit v1.1 From 1665a0d636a0d4e97000e16bd7a2b482e966c446 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 3 Jan 2013 03:29:40 +0000 Subject: make ResetMoveToTarget cancel any 'force' waiting to be applied to avatar ( by the odd use of Velocity) --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 704bad8..c16c544 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1990,7 +1990,8 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name); MovingToTarget = false; - MoveToPositionTarget = Vector3.Zero; +// MoveToPositionTarget = Vector3.Zero; + m_forceToApply = null; // cancel possible last action // We need to reset the control flag as the ScenePresenceAnimator uses this to determine the correct // resting animation (e.g. hover or stand). NPCs don't have a client that will quickly reset this flag. @@ -2148,10 +2149,7 @@ namespace OpenSim.Region.Framework.Scenes } if (MovingToTarget) - { ResetMoveToTarget(); - m_forceToApply = null; - } Velocity = Vector3.Zero; @@ -2272,10 +2270,7 @@ namespace OpenSim.Region.Framework.Scenes RemoveFromPhysicalScene(); if (MovingToTarget) - { ResetMoveToTarget(); - m_forceToApply = null; - } Velocity = Vector3.Zero; -- cgit v1.1 From a285ff7e6942f9b55b18b00a765a5b4491fba011 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 3 Jan 2013 14:27:21 +0000 Subject: check land permitions on sit target for unscripted sits --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c16c544..5087882 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2247,6 +2247,17 @@ namespace OpenSim.Region.Framework.Scenes return false; } + + private bool CanEnterLandPosition(Vector3 testPos) + { + ILandObject land = m_scene.LandChannel.GetLandObject(testPos.X, testPos.Y); + + if (land == null || land.LandData.Name == "NO_LAND") + return true; + + return land.CanBeOnThisLand(UUID,testPos.Z); + } + // status // < 0 ignore // 0 bad sit spot @@ -2265,6 +2276,12 @@ namespace OpenSim.Region.Framework.Scenes if (part == null) return; + Vector3 targetPos = part.GetWorldPosition() + offset * part.GetWorldRotation(); + if(!CanEnterLandPosition(targetPos)) + { + ControllingClient.SendAlertMessage(" Sit position on restricted land, try another spot"); + return; + } // m_log.InfoFormat("physsit {0} {1}", offset.ToString(),Orientation.ToString()); RemoveFromPhysicalScene(); -- cgit v1.1