aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs93
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs2
2 files changed, 47 insertions, 48 deletions
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
2082 if (part == null) 2082 if (part == null)
2083 return; 2083 return;
2084 2084
2085 // TODO: determine position to sit at based on scene geometry; don't trust offset from client
2086 // see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it
2087
2088 if (PhysicsActor != null) 2085 if (PhysicsActor != null)
2089 m_sitAvatarHeight = PhysicsActor.Size.Z * 0.5f; 2086 m_sitAvatarHeight = PhysicsActor.Size.Z * 0.5f;
2090 2087
@@ -2103,25 +2100,8 @@ namespace OpenSim.Region.Framework.Scenes
2103 } 2100 }
2104 else 2101 else
2105 { 2102 {
2106// if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10) 2103 if (PhysicsSit(part,offset)) // physics engine
2107// { 2104 return;
2108// m_log.DebugFormat(
2109// "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is unset and within 10m",
2110// Name, part.Name, part.LocalId);
2111
2112 if (m_scene.PhysicsScene != null &&
2113 part.PhysActor != null &&
2114 Util.GetDistanceTo(AbsolutePosition, pos) <= 30)
2115 {
2116
2117 Vector3 camdif = CameraPosition - part.AbsolutePosition;
2118 camdif.Normalize();
2119
2120// m_log.InfoFormat("sit {0} {1}", offset.ToString(), camdif.ToString());
2121
2122 if (m_scene.PhysicsScene.SitAvatar(part.PhysActor, AbsolutePosition, CameraPosition, offset, new Vector3(0.35f, 0, 0.65f), PhysicsSitResponse) != 0)
2123 return;
2124 }
2125 2105
2126 if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10) 2106 if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10)
2127 { 2107 {
@@ -2129,12 +2109,6 @@ namespace OpenSim.Region.Framework.Scenes
2129 AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight); 2109 AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight);
2130 canSit = true; 2110 canSit = true;
2131 } 2111 }
2132// else
2133// {
2134// m_log.DebugFormat(
2135// "[SCENE PRESENCE]: Ignoring sit request of {0} on {1} {2} because sit target is unset and outside 10m",
2136// Name, part.Name, part.LocalId);
2137// }
2138 } 2112 }
2139 2113
2140 if (canSit) 2114 if (canSit)
@@ -2196,14 +2170,6 @@ namespace OpenSim.Region.Framework.Scenes
2196 m_requestedSitTargetID = part.LocalId; 2170 m_requestedSitTargetID = part.LocalId;
2197 m_requestedSitTargetUUID = targetID; 2171 m_requestedSitTargetUUID = targetID;
2198 2172
2199// m_log.DebugFormat("[SIT]: Client requested Sit Position: {0}", offset);
2200
2201 if (m_scene.PhysicsScene.SupportsRayCast())
2202 {
2203 //m_scene.PhysicsScene.RaycastWorld(Vector3.Zero,Vector3.Zero, 0.01f,new RaycastCallback());
2204 //SitRayCastAvatarPosition(part);
2205 //return;
2206 }
2207 } 2173 }
2208 else 2174 else
2209 { 2175 {
@@ -2213,24 +2179,57 @@ namespace OpenSim.Region.Framework.Scenes
2213 SendSitResponse(targetID, offset, Quaternion.Identity); 2179 SendSitResponse(targetID, offset, Quaternion.Identity);
2214 } 2180 }
2215 2181
2216 public void PhysicsSitResponse(int status, uint partID, Vector3 offset, Quaternion Orientation) 2182 // returns false if does not suport so older sit can be tried
2183 public bool PhysicsSit(SceneObjectPart part, Vector3 offset)
2217 { 2184 {
2185 if (part == null || part.ParentGroup.IsAttachment)
2186 {
2187 return true;
2188 }
2218 2189
2219 if (status < 0) 2190 if ( m_scene.PhysicsScene == null)
2191 return false;
2192
2193 if (part.PhysActor == null)
2220 { 2194 {
2221 ControllingClient.SendAlertMessage("Sit position no longer exists"); 2195 // none physcis shape
2222 return; 2196 if (part.PhysicsShapeType == (byte)PhysicsShapeType.None)
2197 ControllingClient.SendAlertMessage(" There is no suitable surface to sit on, try another spot.");
2198 else
2199 { // non physical phantom TODO
2200 ControllingClient.SendAlertMessage(" There is no suitable surface to sit on, try another spot.");
2201 return false;
2202 }
2203 return true;
2223 } 2204 }
2224 2205
2225 if (status == 0) 2206 // not doing autopilot
2207 m_requestedSitTargetID = 0;
2208
2209 if (m_scene.PhysicsScene.SitAvatar(part.PhysActor, AbsolutePosition, CameraPosition, offset, new Vector3(0.35f, 0, 0.65f), PhysicsSitResponse) != 0)
2210 return true;
2211
2212 return false;
2213 }
2214
2215 // status
2216 // < 0 ignore
2217 // 0 bad sit spot
2218 public void PhysicsSitResponse(int status, uint partID, Vector3 offset, Quaternion Orientation)
2219 {
2220 if (status < 0)
2226 return; 2221 return;
2227 2222
2228 SceneObjectPart part = m_scene.GetSceneObjectPart(partID); 2223 if (status == 0)
2229 if (part == null || part.ParentGroup.IsAttachment)
2230 { 2224 {
2225 ControllingClient.SendAlertMessage(" There is no suitable surface to sit on, try another spot.");
2231 return; 2226 return;
2232 } 2227 }
2233 2228
2229 SceneObjectPart part = m_scene.GetSceneObjectPart(partID);
2230 if (part == null)
2231 return;
2232
2234// m_log.InfoFormat("physsit {0} {1}", offset.ToString(),Orientation.ToString()); 2233// m_log.InfoFormat("physsit {0} {1}", offset.ToString(),Orientation.ToString());
2235 2234
2236 part.AddSittingAvatar(UUID); 2235 part.AddSittingAvatar(UUID);
@@ -2242,16 +2241,14 @@ namespace OpenSim.Region.Framework.Scenes
2242 ControllingClient.SendSitResponse( 2241 ControllingClient.SendSitResponse(
2243 part.UUID, offset, Orientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook); 2242 part.UUID, offset, Orientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook);
2244 2243
2245 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); 2244 // not using autopilot
2246
2247 // assuming no autopilot in use
2248 Velocity = Vector3.Zero; 2245 Velocity = Vector3.Zero;
2249 RemoveFromPhysicalScene(); 2246 RemoveFromPhysicalScene();
2250 2247
2251 Rotation = Orientation; 2248 Rotation = Orientation;
2252 m_pos = offset; 2249 m_pos = offset;
2253 2250
2254 m_requestedSitTargetID = 0; // invalidate the viewer sit comand for now 2251 m_requestedSitTargetID = 0;
2255 part.ParentGroup.AddAvatar(UUID); 2252 part.ParentGroup.AddAvatar(UUID);
2256 2253
2257 ParentPart = part; 2254 ParentPart = part;
@@ -2259,6 +2256,8 @@ namespace OpenSim.Region.Framework.Scenes
2259 2256
2260 Animator.TrySetMovementAnimation("SIT"); 2257 Animator.TrySetMovementAnimation("SIT");
2261 SendAvatarDataToAllAgents(); 2258 SendAvatarDataToAllAgents();
2259
2260 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
2262 } 2261 }
2263 2262
2264 2263
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs
index 225bff8..c1a0ca9 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs
@@ -93,7 +93,7 @@ namespace OpenSim.Region.Physics.OdePlugin
93 rayDir.Y *= t; 93 rayDir.Y *= t;
94 rayDir.Z *= t; 94 rayDir.Z *= t;
95 95
96 raylen += 0.5f; 96 raylen += 30f; // focal point may be far
97 List<ContactResult> rayResults; 97 List<ContactResult> rayResults;
98 98
99 rayResults = m_scene.RaycastActor(actor, avCameraPosition, rayDir , raylen, 1); 99 rayResults = m_scene.RaycastActor(actor, avCameraPosition, rayDir , raylen, 1);