From de3180a63ecb89971321b7dce60dd86703f87e6d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 5 Dec 2012 23:19:18 +0000 Subject: avatar collision plane send to viewer is only relative to feet. change avatar collider, just rounding the boxes, etc --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index bacc9c9..f5d609d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3465,6 +3465,7 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.", true); } + /// /// Event called by the physics plugin to tell the avatar about a collision. /// @@ -3494,7 +3495,6 @@ namespace OpenSim.Region.Framework.Scenes CollisionEventUpdate collisionData = (CollisionEventUpdate)e; Dictionary coldata = collisionData.m_objCollisionList; - CollisionPlane = Vector4.UnitW; // // No collisions at all means we may be flying. Update always // // to make falling work @@ -3504,6 +3504,8 @@ namespace OpenSim.Region.Framework.Scenes // m_lastColCount = coldata.Count; // } + CollisionPlane = Vector4.UnitW; + if (coldata.Count != 0) { switch (Animator.CurrentMovementAnimation) @@ -3517,17 +3519,22 @@ namespace OpenSim.Region.Framework.Scenes ContactPoint lowest; lowest.SurfaceNormal = Vector3.Zero; lowest.Position = Vector3.Zero; - lowest.Position.Z = Single.NaN; + lowest.Position.Z = float.MaxValue; foreach (ContactPoint contact in coldata.Values) { - if (Single.IsNaN(lowest.Position.Z) || contact.Position.Z < lowest.Position.Z) + + if (contact.CharacterFeet && contact.Position.Z < lowest.Position.Z) { lowest = contact; } } - CollisionPlane = new Vector4(-lowest.SurfaceNormal, -Vector3.Dot(lowest.Position, lowest.SurfaceNormal)); + if (lowest.Position.Z != float.MaxValue) + { + lowest.SurfaceNormal = -lowest.SurfaceNormal; + CollisionPlane = new Vector4(lowest.SurfaceNormal, Vector3.Dot(lowest.Position, lowest.SurfaceNormal)); + } } break; } -- cgit v1.1 From d2499c4c314b290c42f454913305d97c6eec92d6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 7 Dec 2012 15:54:46 +0000 Subject: *TEST* Use new avatar size in ubitODE. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f5d609d..b6eae8e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1260,6 +1260,12 @@ namespace OpenSim.Region.Framework.Scenes PhysicsActor.Size = new Vector3(0.45f, 0.6f, height); } + public void SetSize(Vector3 size, float feetoffset) + { + if (PhysicsActor != null && !IsChildAgent) + PhysicsActor.setAvatarSize(size, feetoffset); + } + /// /// Complete Avatar's movement into the region. /// -- cgit v1.1 From 2ea0dc55d7ea6da6e91ab614856cdeece7eae5d2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 7 Dec 2012 20:06:35 +0000 Subject: create a new ode character also with the new information --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b6eae8e..7602d6b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3450,9 +3450,15 @@ namespace OpenSim.Region.Framework.Scenes Vector3 pVec = AbsolutePosition; +/* PhysicsActor = scene.AddAvatar( LocalId, Firstname + "." + Lastname, pVec, new Vector3(0.45f, 0.6f, Appearance.AvatarHeight), isFlying); +*/ + + PhysicsActor = scene.AddAvatar( + LocalId, Firstname + "." + Lastname, pVec, + Appearance.AvatarBoxSize,Appearance.AvatarFeetOffset, isFlying); //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; -- cgit v1.1 From 93bede4e6aa0838e14f39f5e641b028267d2683c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 7 Dec 2012 21:26:58 +0000 Subject: revert the use of avatar skeleton and use avatar size provided by viewers, since at least for now seems good enought --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7602d6b..9dfccca 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3443,8 +3443,8 @@ namespace OpenSim.Region.Framework.Scenes Name, Scene.RegionInfo.RegionName); } - if (Appearance.AvatarHeight == 0) - Appearance.SetHeight(); +// if (Appearance.AvatarHeight == 0) +// Appearance.SetHeight(); PhysicsScene scene = m_scene.PhysicsScene; -- cgit v1.1 From c73c2fb0707ee4dc78a354d932293f3e7e83ac50 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 7 Dec 2012 21:53:33 +0000 Subject: add some default size setting and checks --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9dfccca..9ada5bb 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3443,8 +3443,9 @@ namespace OpenSim.Region.Framework.Scenes Name, Scene.RegionInfo.RegionName); } -// if (Appearance.AvatarHeight == 0) + if (Appearance.AvatarHeight == 0) // Appearance.SetHeight(); + Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f)); PhysicsScene scene = m_scene.PhysicsScene; -- cgit v1.1 From b3a77c16bd2ad83076ddf19275b2f104210bba07 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 13 Dec 2012 07:34:27 +0000 Subject: FIX small avatars movement on terrain. (avatar appearance getting even more messy) --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 40 +++++++++++++++++++++--- 1 file changed, 36 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9ada5bb..6299a8e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -140,6 +140,8 @@ namespace OpenSim.Region.Framework.Scenes private Vector3 m_lastPosition; private Quaternion m_lastRotation; private Vector3 m_lastVelocity; + private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f); + private Vector3? m_forceToApply; private int m_userFlags; @@ -563,6 +565,23 @@ namespace OpenSim.Region.Framework.Scenes } } + public override Vector3 AngularVelocity + { + get + { + if (PhysicsActor != null) + { + m_rotationalvelocity = PhysicsActor.RotationalVelocity; + + // m_log.DebugFormat( + // "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!", + // m_velocity, Name, Scene.RegionInfo.RegionName); + } + + return m_rotationalvelocity; + } + } + private Quaternion m_bodyRot = Quaternion.Identity; public Quaternion Rotation @@ -1264,6 +1283,7 @@ namespace OpenSim.Region.Framework.Scenes { if (PhysicsActor != null && !IsChildAgent) PhysicsActor.setAvatarSize(size, feetoffset); + } /// @@ -2572,9 +2592,13 @@ namespace OpenSim.Region.Framework.Scenes // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to // grab the latest PhysicsActor velocity, whereas m_velocity is often // storing a requested force instead of an actual traveling velocity + if (Appearance.AvatarSize != m_lastSize) + { + m_lastSize = Appearance.AvatarSize; + SendAvatarDataToAllAgents(); + } - // Throw away duplicate or insignificant updates - if (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || + else if (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) { @@ -2872,6 +2896,8 @@ namespace OpenSim.Region.Framework.Scenes avatar.ControllingClient.SendAppearance( UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); + + } #endregion @@ -3517,10 +3543,9 @@ namespace OpenSim.Region.Framework.Scenes // m_lastColCount = coldata.Count; // } - CollisionPlane = Vector4.UnitW; - if (coldata.Count != 0) { +/* switch (Animator.CurrentMovementAnimation) { case "STAND": @@ -3529,6 +3554,7 @@ namespace OpenSim.Region.Framework.Scenes case "CROUCH": case "CROUCHWALK": { + */ ContactPoint lowest; lowest.SurfaceNormal = Vector3.Zero; lowest.Position = Vector3.Zero; @@ -3548,10 +3574,16 @@ namespace OpenSim.Region.Framework.Scenes lowest.SurfaceNormal = -lowest.SurfaceNormal; CollisionPlane = new Vector4(lowest.SurfaceNormal, Vector3.Dot(lowest.Position, lowest.SurfaceNormal)); } + else + CollisionPlane = Vector4.UnitW; +/* } break; } +*/ } + else + CollisionPlane = Vector4.UnitW; RaiseCollisionScriptEvents(coldata); -- cgit v1.1 From c0368f4143ae13b847bc6b10198de7f09414caee Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 13 Dec 2012 07:39:10 +0000 Subject: fix coment out code not in use --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6299a8e..92a4748 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -564,7 +564,7 @@ namespace OpenSim.Region.Framework.Scenes // Scene.RegionInfo.RegionName, Name, m_velocity); } } - +// public override Vector3 AngularVelocity { get @@ -581,7 +581,7 @@ namespace OpenSim.Region.Framework.Scenes return m_rotationalvelocity; } } - +// private Quaternion m_bodyRot = Quaternion.Identity; public Quaternion Rotation -- cgit v1.1 From 94a659a9e08cb5e6cb4d5b3aa7d46b11217098a0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 13 Dec 2012 07:46:33 +0000 Subject: fix the 'fix' --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 92a4748..45cae51 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -564,7 +564,7 @@ namespace OpenSim.Region.Framework.Scenes // Scene.RegionInfo.RegionName, Name, m_velocity); } } -// +/* public override Vector3 AngularVelocity { get @@ -581,7 +581,7 @@ namespace OpenSim.Region.Framework.Scenes return m_rotationalvelocity; } } -// +/* private Quaternion m_bodyRot = Quaternion.Identity; public Quaternion Rotation -- cgit v1.1 From 5ad424a79278e0079d1f2540d470541f276ce71c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 13 Dec 2012 07:48:29 +0000 Subject: right fix this time ?? --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 45cae51..e026ffd 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -581,7 +581,7 @@ namespace OpenSim.Region.Framework.Scenes return m_rotationalvelocity; } } -/* +*/ private Quaternion m_bodyRot = Quaternion.Identity; public Quaternion Rotation -- cgit v1.1