diff options
author | Charles Krinke | 2008-07-03 22:24:31 +0000 |
---|---|---|
committer | Charles Krinke | 2008-07-03 22:24:31 +0000 |
commit | af82b1e710d1441a23f4d6f4dbd7de71685c8b46 (patch) | |
tree | c301be00b8fd665f9dc442f5e2885ce9fa5a104a /OpenSim/Region/Environment/Scenes/ScenePresence.cs | |
parent | *.Raw files should now be loadable using "terrain load-tile" functionality (diff) | |
download | opensim-SC_OLD-af82b1e710d1441a23f4d6f4dbd7de71685c8b46.zip opensim-SC_OLD-af82b1e710d1441a23f4d6f4dbd7de71685c8b46.tar.gz opensim-SC_OLD-af82b1e710d1441a23f4d6f4dbd7de71685c8b46.tar.bz2 opensim-SC_OLD-af82b1e710d1441a23f4d6f4dbd7de71685c8b46.tar.xz |
Mantis#1463. Thank you, Melanie for a patch that addresses:
sometimes, incorrect sit rotation is sent to other clients
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 3a966f4..3daa680 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -1073,13 +1073,57 @@ namespace OpenSim.Region.Environment.Scenes | |||
1073 | TrySetMovementAnimation("STAND"); | 1073 | TrySetMovementAnimation("STAND"); |
1074 | } | 1074 | } |
1075 | 1075 | ||
1076 | private SceneObjectPart FindNextAvailableSitTarget(LLUUID targetID) | ||
1077 | { | ||
1078 | SceneObjectPart targetPart = m_scene.GetSceneObjectPart(targetID); | ||
1079 | if (targetPart == null) | ||
1080 | return null; | ||
1081 | |||
1082 | // If the primitive the player clicked on has a sit target and that sit target is not full, that sit target is used. | ||
1083 | // If the primitive the player clicked on has no sit target, and one or more other linked objects have sit targets that are not full, the sit target of the object with the lowest link number will be used. | ||
1084 | |||
1085 | // Get our own copy of the part array, and sort into the order we want to test | ||
1086 | SceneObjectPart[] partArray = targetPart.ParentGroup.GetParts(); | ||
1087 | Array.Sort(partArray, delegate(SceneObjectPart p1, SceneObjectPart p2) { | ||
1088 | // we want the originally selected part first, then the rest in link order -- so make the selected part link num (-1) | ||
1089 | int linkNum1 = p1==targetPart ? -1 : p1.LinkNum; | ||
1090 | int linkNum2 = p2==targetPart ? -1 : p2.LinkNum; | ||
1091 | return linkNum1 - linkNum2; | ||
1092 | } | ||
1093 | ); | ||
1094 | |||
1095 | //look for prims with explicit sit targets that are available | ||
1096 | foreach(SceneObjectPart part in partArray) { | ||
1097 | |||
1098 | // Is a sit target available? | ||
1099 | Vector3 avSitOffSet = part.GetSitTargetPosition(); | ||
1100 | Quaternion avSitOrientation = part.GetSitTargetOrientation(); | ||
1101 | LLUUID avOnTargetAlready = part.GetAvatarOnSitTarget(); | ||
1102 | |||
1103 | bool SitTargetUnOccupied = (!(avOnTargetAlready != LLUUID.Zero)); | ||
1104 | bool SitTargetisSet = | ||
1105 | (!(avSitOffSet.x == 0 && avSitOffSet.y == 0 && avSitOffSet.z == 0 && avSitOrientation.w == 0 && | ||
1106 | avSitOrientation.x == 0 && avSitOrientation.y == 0 && avSitOrientation.z == 1)); | ||
1107 | |||
1108 | if (SitTargetisSet && SitTargetUnOccupied) | ||
1109 | { | ||
1110 | //switch the target to this prim | ||
1111 | return part; | ||
1112 | } | ||
1113 | } | ||
1114 | |||
1115 | // no explicit sit target found - use original target | ||
1116 | return targetPart; | ||
1117 | } | ||
1118 | |||
1076 | private void SendSitResponse(IClientAPI remoteClient, LLUUID targetID, LLVector3 offset) | 1119 | private void SendSitResponse(IClientAPI remoteClient, LLUUID targetID, LLVector3 offset) |
1077 | { | 1120 | { |
1078 | bool autopilot = true; | 1121 | bool autopilot = true; |
1079 | LLVector3 pos = new LLVector3(); | 1122 | LLVector3 pos = new LLVector3(); |
1080 | LLQuaternion sitOrientation = new LLQuaternion(0, 0, 0, 1); | 1123 | LLQuaternion sitOrientation = new LLQuaternion(0, 0, 0, 1); |
1081 | 1124 | ||
1082 | SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); | 1125 | //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); |
1126 | SceneObjectPart part = FindNextAvailableSitTarget(targetID); | ||
1083 | if (part != null) | 1127 | if (part != null) |
1084 | { | 1128 | { |
1085 | // TODO: determine position to sit at based on scene geometry; don't trust offset from client | 1129 | // TODO: determine position to sit at based on scene geometry; don't trust offset from client |
@@ -1153,7 +1197,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1153 | StandUp(); | 1197 | StandUp(); |
1154 | } | 1198 | } |
1155 | 1199 | ||
1156 | SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); | 1200 | //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); |
1201 | SceneObjectPart part = FindNextAvailableSitTarget(targetID); | ||
1157 | 1202 | ||
1158 | if (part != null) | 1203 | if (part != null) |
1159 | { | 1204 | { |