diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Animation/MovementAnimationOverrides.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/CollisionSounds.cs | 68 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SOPVehicle.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 85 | ||||
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 13 | ||||
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 43 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 79 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 113 |
9 files changed, 291 insertions, 133 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/MovementAnimationOverrides.cs b/OpenSim/Region/Framework/Scenes/Animation/MovementAnimationOverrides.cs index d59678b..ca3ebfb 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/MovementAnimationOverrides.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/MovementAnimationOverrides.cs | |||
@@ -52,6 +52,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
52 | private static readonly ILog m_log = | 52 | private static readonly ILog m_log = |
53 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 53 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
54 | 54 | ||
55 | private object MAOLock = new object(); | ||
55 | private Dictionary<string, UUID> m_overrides = new Dictionary<string, UUID>(); | 56 | private Dictionary<string, UUID> m_overrides = new Dictionary<string, UUID>(); |
56 | public void SetOverride(string state, UUID animID) | 57 | public void SetOverride(string state, UUID animID) |
57 | { | 58 | { |
@@ -66,13 +67,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
66 | 67 | ||
67 | m_log.DebugFormat("Setting override for {0} to {1}", state, animID); | 68 | m_log.DebugFormat("Setting override for {0} to {1}", state, animID); |
68 | 69 | ||
69 | lock (m_overrides) | 70 | lock (MAOLock) |
70 | m_overrides[state] = animID; | 71 | m_overrides[state] = animID; |
71 | } | 72 | } |
72 | 73 | ||
73 | public UUID GetOverriddenAnimation(string state) | 74 | public UUID GetOverriddenAnimation(string state) |
74 | { | 75 | { |
75 | lock (m_overrides) | 76 | lock (MAOLock) |
76 | { | 77 | { |
77 | if (m_overrides.ContainsKey(state)) | 78 | if (m_overrides.ContainsKey(state)) |
78 | return m_overrides[state]; | 79 | return m_overrides[state]; |
@@ -83,7 +84,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
83 | 84 | ||
84 | public Dictionary<string, UUID> CloneAOPairs() | 85 | public Dictionary<string, UUID> CloneAOPairs() |
85 | { | 86 | { |
86 | lock (m_overrides) | 87 | lock (MAOLock) |
87 | { | 88 | { |
88 | return new Dictionary<string, UUID>(m_overrides); | 89 | return new Dictionary<string, UUID>(m_overrides); |
89 | } | 90 | } |
@@ -91,7 +92,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
91 | 92 | ||
92 | public void CopyAOPairsFrom(Dictionary<string, UUID> src) | 93 | public void CopyAOPairsFrom(Dictionary<string, UUID> src) |
93 | { | 94 | { |
94 | lock (m_overrides) | 95 | lock (MAOLock) |
95 | { | 96 | { |
96 | m_overrides.Clear(); | 97 | m_overrides.Clear(); |
97 | m_overrides = new Dictionary<string, UUID>(src); | 98 | m_overrides = new Dictionary<string, UUID>(src); |
diff --git a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs index 075724e..84817a0 100644 --- a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs +++ b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs | |||
@@ -128,20 +128,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
128 | if (part.CollisionSoundType < 0) | 128 | if (part.CollisionSoundType < 0) |
129 | return; | 129 | return; |
130 | 130 | ||
131 | float volume = 0.0f; | 131 | float volume = part.CollisionSoundVolume; |
132 | bool HaveSound = false; | ||
133 | 132 | ||
134 | UUID soundID = part.CollisionSound; | 133 | UUID soundID = part.CollisionSound; |
135 | 134 | ||
136 | if (part.CollisionSoundType > 0) | 135 | bool HaveSound = false; |
136 | switch (part.CollisionSoundType) | ||
137 | { | 137 | { |
138 | // soundID = part.CollisionSound; | 138 | case 0: // default sounds |
139 | volume = part.CollisionSoundVolume; | 139 | volume = 1.0f; |
140 | if (volume == 0.0f) | 140 | break; |
141 | return; | 141 | case 1: // selected sound |
142 | HaveSound = true; | 142 | if(soundID == part.invalidCollisionSoundUUID) |
143 | return; | ||
144 | HaveSound = true; | ||
145 | break; | ||
146 | case 2: // default sounds with volume set by script | ||
147 | default: | ||
148 | break; | ||
143 | } | 149 | } |
144 | 150 | ||
151 | if (volume == 0.0f) | ||
152 | return; | ||
153 | |||
145 | bool doneownsound = false; | 154 | bool doneownsound = false; |
146 | 155 | ||
147 | int thisMaterial = (int)part.Material; | 156 | int thisMaterial = (int)part.Material; |
@@ -152,7 +161,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
152 | CollisionForSoundInfo colInfo; | 161 | CollisionForSoundInfo colInfo; |
153 | uint id; | 162 | uint id; |
154 | 163 | ||
155 | for(int i = 0; i< collidersinfolist.Count; i++) | 164 | for(int i = 0; i < collidersinfolist.Count; i++) |
156 | { | 165 | { |
157 | colInfo = collidersinfolist[i]; | 166 | colInfo = collidersinfolist[i]; |
158 | 167 | ||
@@ -163,15 +172,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
163 | { | 172 | { |
164 | if (!HaveSound) | 173 | if (!HaveSound) |
165 | { | 174 | { |
166 | volume = Math.Abs(colInfo.relativeVel); | 175 | float vol = Math.Abs(colInfo.relativeVel); |
167 | if (volume < 0.2f) | 176 | if (vol < 0.2f) |
168 | continue; | 177 | continue; |
169 | 178 | ||
170 | volume *= volume * .0625f; // 4m/s == full volume | 179 | vol *= vol * .0625f; // 4m/s == full volume |
171 | if (volume > 1.0f) | 180 | if (vol > 1.0f) |
172 | volume = 1.0f; | 181 | vol = 1.0f; |
173 | 182 | ||
174 | soundID = m_TerrainPart[thisMaterial]; | 183 | soundID = m_TerrainPart[thisMaterial]; |
184 | volume *= vol; | ||
175 | } | 185 | } |
176 | part.SendCollisionSound(soundID, volume, colInfo.position); | 186 | part.SendCollisionSound(soundID, volume, colInfo.position); |
177 | doneownsound = true; | 187 | doneownsound = true; |
@@ -187,7 +197,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
187 | 197 | ||
188 | if (!HaveSound) | 198 | if (!HaveSound) |
189 | { | 199 | { |
190 | if (otherPart.CollisionSoundType > 0) | 200 | if (otherPart.CollisionSoundType == 1) |
191 | { | 201 | { |
192 | soundID = otherPart.CollisionSound; | 202 | soundID = otherPart.CollisionSound; |
193 | volume = otherPart.CollisionSoundVolume; | 203 | volume = otherPart.CollisionSoundVolume; |
@@ -196,19 +206,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
196 | } | 206 | } |
197 | else | 207 | else |
198 | { | 208 | { |
199 | volume = Math.Abs(colInfo.relativeVel); | 209 | if (otherPart.CollisionSoundType == 2) |
200 | if (volume < 0.2f) | 210 | { |
211 | volume = otherPart.CollisionSoundVolume; | ||
212 | if (volume == 0.0f) | ||
213 | continue; | ||
214 | } | ||
215 | |||
216 | float vol = Math.Abs(colInfo.relativeVel); | ||
217 | if (vol < 0.2f) | ||
201 | continue; | 218 | continue; |
202 | 219 | ||
203 | volume *= volume * .0625f; // 4m/s == full volume | 220 | vol *= vol * .0625f; // 4m/s == full volume |
204 | if (volume > 1.0f) | 221 | if (vol > 1.0f) |
205 | volume = 1.0f; | 222 | vol = 1.0f; |
206 | 223 | ||
207 | int otherMaterial = (int)otherPart.Material; | 224 | int otherMaterial = (int)otherPart.Material; |
208 | if (otherMaterial >= MaxMaterials) | 225 | if (otherMaterial >= MaxMaterials) |
209 | otherMaterial = 3; | 226 | otherMaterial = 3; |
210 | 227 | ||
211 | soundID = m_PartPart[thisMatScaled + otherMaterial]; | 228 | soundID = m_PartPart[thisMatScaled + otherMaterial]; |
229 | volume *= vol; | ||
212 | } | 230 | } |
213 | } | 231 | } |
214 | 232 | ||
@@ -261,10 +279,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
261 | { | 279 | { |
262 | if (otherPart.CollisionSoundType < 0) | 280 | if (otherPart.CollisionSoundType < 0) |
263 | continue; | 281 | continue; |
264 | if (otherPart.CollisionSoundType > 0 && otherPart.CollisionSoundVolume > 0f) | 282 | if (otherPart.CollisionSoundType == 1 && otherPart.CollisionSoundVolume > 0f) |
265 | otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, colInfo.position); | 283 | otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, colInfo.position); |
266 | else | 284 | else |
267 | { | 285 | { |
286 | float volmod = 1.0f; | ||
287 | if (otherPart.CollisionSoundType == 2) | ||
288 | { | ||
289 | volmod = otherPart.CollisionSoundVolume; | ||
290 | if(volmod == 0.0) | ||
291 | continue; | ||
292 | } | ||
268 | volume = Math.Abs(colInfo.relativeVel); | 293 | volume = Math.Abs(colInfo.relativeVel); |
269 | // Most noral collisions (running into walls, stairs) | 294 | // Most noral collisions (running into walls, stairs) |
270 | // should never be heard. | 295 | // should never be heard. |
@@ -281,6 +306,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
281 | if (otherMaterial >= MaxMaterials) | 306 | if (otherMaterial >= MaxMaterials) |
282 | otherMaterial = 3; | 307 | otherMaterial = 3; |
283 | 308 | ||
309 | volume *= volmod; | ||
284 | soundID = m_PartPart[thisMatScaled + otherMaterial]; | 310 | soundID = m_PartPart[thisMatScaled + otherMaterial]; |
285 | otherPart.SendCollisionSound(soundID, volume, colInfo.position); | 311 | otherPart.SendCollisionSound(soundID, volume, colInfo.position); |
286 | } | 312 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs index 2b33cf7..897918a 100644 --- a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs +++ b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs | |||
@@ -406,6 +406,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
406 | ph.SetVehicle(vd); | 406 | ph.SetVehicle(vd); |
407 | } | 407 | } |
408 | 408 | ||
409 | public bool CameraDecoupled | ||
410 | { | ||
411 | get | ||
412 | { | ||
413 | if((vd.m_flags & VehicleFlag.CAMERA_DECOUPLED) != 0) | ||
414 | return true; | ||
415 | return false; | ||
416 | } | ||
417 | } | ||
418 | |||
409 | private XmlTextWriter writer; | 419 | private XmlTextWriter writer; |
410 | 420 | ||
411 | private void XWint(string name, int i) | 421 | private void XWint(string name, int i) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index c49edd1..4d491d1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -164,55 +164,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
164 | /// </summary> | 164 | /// </summary> |
165 | /// <param name="primLocalID"></param> | 165 | /// <param name="primLocalID"></param> |
166 | /// <param name="remoteClient"></param> | 166 | /// <param name="remoteClient"></param> |
167 | public void SelectPrim(uint primLocalID, IClientAPI remoteClient) | 167 | public void SelectPrim(List<uint> primIDs, IClientAPI remoteClient) |
168 | { | 168 | { |
169 | /* | 169 | List<ISceneEntity> needUpdates = new List<ISceneEntity>(); |
170 | SceneObjectPart part = GetSceneObjectPart(primLocalID); | ||
171 | 170 | ||
172 | if (null == part) | 171 | foreach(uint primLocalID in primIDs) |
173 | return; | 172 | { |
174 | 173 | SceneObjectPart part = GetSceneObjectPart(primLocalID); | |
175 | if (part.IsRoot) | ||
176 | { | ||
177 | SceneObjectGroup sog = part.ParentGroup; | ||
178 | sog.SendPropertiesToClient(remoteClient); | ||
179 | |||
180 | // A prim is only tainted if it's allowed to be edited by the person clicking it. | ||
181 | if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId) | ||
182 | || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId)) | ||
183 | { | ||
184 | sog.IsSelected = true; | ||
185 | EventManager.TriggerParcelPrimCountTainted(); | ||
186 | } | ||
187 | } | ||
188 | else | ||
189 | { | ||
190 | part.SendPropertiesToClient(remoteClient); | ||
191 | } | ||
192 | */ | ||
193 | SceneObjectPart part = GetSceneObjectPart(primLocalID); | ||
194 | 174 | ||
195 | if (null == part) | 175 | if (part == null) |
196 | return; | 176 | continue; |
197 | 177 | ||
198 | SceneObjectGroup sog = part.ParentGroup; | 178 | SceneObjectGroup sog = part.ParentGroup; |
199 | if (sog == null) | 179 | if (sog == null) |
200 | return; | 180 | continue; |
201 | 181 | ||
202 | part.SendPropertiesToClient(remoteClient); | 182 | needUpdates.Add((ISceneEntity)part); |
203 | 183 | ||
204 | // waste of time because properties do not send prim flags as they should | 184 | // waste of time because properties do not send prim flags as they should |
205 | // if a friend got or lost edit rights after login, a full update is needed | 185 | // if a friend got or lost edit rights after login, a full update is needed |
206 | if(sog.OwnerID != remoteClient.AgentId) | 186 | if(sog.OwnerID != remoteClient.AgentId) |
207 | part.SendFullUpdate(remoteClient); | 187 | part.SendFullUpdate(remoteClient); |
208 | 188 | ||
209 | // A prim is only tainted if it's allowed to be edited by the person clicking it. | 189 | // A prim is only tainted if it's allowed to be edited by the person clicking it. |
210 | if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId) | 190 | if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId) |
211 | || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId)) | 191 | || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId)) |
212 | { | 192 | { |
213 | part.IsSelected = true; | 193 | part.IsSelected = true; |
214 | EventManager.TriggerParcelPrimCountTainted(); | 194 | EventManager.TriggerParcelPrimCountTainted(); |
195 | } | ||
215 | } | 196 | } |
197 | |||
198 | if(needUpdates.Count > 0) | ||
199 | remoteClient.SendSelectedPartsProprieties(needUpdates); | ||
216 | } | 200 | } |
217 | 201 | ||
218 | /// <summary> | 202 | /// <summary> |
@@ -377,8 +361,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
377 | if (part == null) | 361 | if (part == null) |
378 | return; | 362 | return; |
379 | 363 | ||
380 | SceneObjectGroup obj = part.ParentGroup; | 364 | SceneObjectGroup group = part.ParentGroup; |
365 | if(group == null || group.IsDeleted) | ||
366 | return; | ||
367 | |||
368 | if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) | ||
369 | { | ||
370 | group.GrabMovement(objectID, offset, pos, remoteClient); | ||
371 | } | ||
381 | 372 | ||
373 | // This is outside the above permissions condition | ||
374 | // so that if the object is locked the client moving the object | ||
375 | // get's it's position on the simulator even if it was the same as before | ||
376 | // This keeps the moving user's client in sync with the rest of the world. | ||
377 | group.SendGroupTerseUpdate(); | ||
378 | |||
382 | SurfaceTouchEventArgs surfaceArg = null; | 379 | SurfaceTouchEventArgs surfaceArg = null; |
383 | if (surfaceArgs != null && surfaceArgs.Count > 0) | 380 | if (surfaceArgs != null && surfaceArgs.Count > 0) |
384 | surfaceArg = surfaceArgs[0]; | 381 | surfaceArg = surfaceArgs[0]; |
@@ -391,9 +388,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
391 | // or if we're meant to pass on touches anyway. Don't send to root prim | 388 | // or if we're meant to pass on touches anyway. Don't send to root prim |
392 | // if prim touched is the root prim as we just did it | 389 | // if prim touched is the root prim as we just did it |
393 | if (((part.ScriptEvents & scriptEvents.touch) == 0) || | 390 | if (((part.ScriptEvents & scriptEvents.touch) == 0) || |
394 | (part.PassTouches && (part.LocalId != obj.RootPart.LocalId))) | 391 | (part.PassTouches && (part.LocalId != group.RootPart.LocalId))) |
395 | { | 392 | { |
396 | EventManager.TriggerObjectGrabbing(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg); | 393 | EventManager.TriggerObjectGrabbing(group.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg); |
397 | } | 394 | } |
398 | } | 395 | } |
399 | 396 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d5dbcaf..0d6af77 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2780,13 +2780,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2780 | else | 2780 | else |
2781 | group.StopScriptInstances(); | 2781 | group.StopScriptInstances(); |
2782 | 2782 | ||
2783 | List<ScenePresence> avatars = group.GetSittingAvatars(); | ||
2784 | foreach (ScenePresence av in avatars) | ||
2785 | { | ||
2786 | if(av.ParentUUID == UUID.Zero) | ||
2787 | av.StandUp(); | ||
2788 | } | ||
2789 | |||
2790 | SceneObjectPart[] partList = group.Parts; | 2783 | SceneObjectPart[] partList = group.Parts; |
2791 | 2784 | ||
2792 | foreach (SceneObjectPart part in partList) | 2785 | foreach (SceneObjectPart part in partList) |
@@ -3336,7 +3329,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3336 | client.OnObjectRequest += RequestPrim; | 3329 | client.OnObjectRequest += RequestPrim; |
3337 | client.OnObjectSelect += SelectPrim; | 3330 | client.OnObjectSelect += SelectPrim; |
3338 | client.OnObjectDeselect += DeselectPrim; | 3331 | client.OnObjectDeselect += DeselectPrim; |
3339 | client.OnGrabUpdate += m_sceneGraph.MoveObject; | ||
3340 | client.OnSpinStart += m_sceneGraph.SpinStart; | 3332 | client.OnSpinStart += m_sceneGraph.SpinStart; |
3341 | client.OnSpinUpdate += m_sceneGraph.SpinObject; | 3333 | client.OnSpinUpdate += m_sceneGraph.SpinObject; |
3342 | client.OnDeRezObject += DeRezObjects; | 3334 | client.OnDeRezObject += DeRezObjects; |
@@ -3464,7 +3456,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3464 | client.OnObjectRequest -= RequestPrim; | 3456 | client.OnObjectRequest -= RequestPrim; |
3465 | client.OnObjectSelect -= SelectPrim; | 3457 | client.OnObjectSelect -= SelectPrim; |
3466 | client.OnObjectDeselect -= DeselectPrim; | 3458 | client.OnObjectDeselect -= DeselectPrim; |
3467 | client.OnGrabUpdate -= m_sceneGraph.MoveObject; | ||
3468 | client.OnSpinStart -= m_sceneGraph.SpinStart; | 3459 | client.OnSpinStart -= m_sceneGraph.SpinStart; |
3469 | client.OnSpinUpdate -= m_sceneGraph.SpinObject; | 3460 | client.OnSpinUpdate -= m_sceneGraph.SpinObject; |
3470 | client.OnDeRezObject -= DeRezObjects; | 3461 | client.OnDeRezObject -= DeRezObjects; |
@@ -3479,6 +3470,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3479 | client.OnRequestObjectPropertiesFamily -= m_sceneGraph.RequestObjectPropertiesFamily; | 3470 | client.OnRequestObjectPropertiesFamily -= m_sceneGraph.RequestObjectPropertiesFamily; |
3480 | client.OnObjectPermissions -= HandleObjectPermissionsUpdate; | 3471 | client.OnObjectPermissions -= HandleObjectPermissionsUpdate; |
3481 | client.OnGrabObject -= ProcessObjectGrab; | 3472 | client.OnGrabObject -= ProcessObjectGrab; |
3473 | client.OnGrabUpdate -= ProcessObjectGrabUpdate; | ||
3482 | client.OnDeGrabObject -= ProcessObjectDeGrab; | 3474 | client.OnDeGrabObject -= ProcessObjectDeGrab; |
3483 | client.OnUndo -= m_sceneGraph.HandleUndo; | 3475 | client.OnUndo -= m_sceneGraph.HandleUndo; |
3484 | client.OnRedo -= m_sceneGraph.HandleRedo; | 3476 | client.OnRedo -= m_sceneGraph.HandleRedo; |
@@ -5036,7 +5028,7 @@ Label_GroupsDone: | |||
5036 | 5028 | ||
5037 | public LandData GetLandData(uint x, uint y) | 5029 | public LandData GetLandData(uint x, uint y) |
5038 | { | 5030 | { |
5039 | m_log.DebugFormat("[SCENE]: returning land for {0},{1}", x, y); | 5031 | // m_log.DebugFormat("[SCENE]: returning land for {0},{1}", x, y); |
5040 | ILandObject parcel = LandChannel.GetLandObject((int)x, (int)y); | 5032 | ILandObject parcel = LandChannel.GetLandObject((int)x, (int)y); |
5041 | if (parcel == null) | 5033 | if (parcel == null) |
5042 | return null; | 5034 | return null; |
@@ -5439,7 +5431,6 @@ Label_GroupsDone: | |||
5439 | } | 5431 | } |
5440 | } | 5432 | } |
5441 | } | 5433 | } |
5442 | |||
5443 | } | 5434 | } |
5444 | 5435 | ||
5445 | public void DeleteFromStorage(UUID uuid) | 5436 | public void DeleteFromStorage(UUID uuid) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index b65d168..0e5720f 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -1674,7 +1674,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1674 | } | 1674 | } |
1675 | } | 1675 | } |
1676 | } | 1676 | } |
1677 | 1677 | /* moved to scene ProcessObjectGrabUpdate | |
1678 | /// <summary> | 1678 | /// <summary> |
1679 | /// Move the given object | 1679 | /// Move the given object |
1680 | /// </summary> | 1680 | /// </summary> |
@@ -1699,7 +1699,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1699 | group.SendGroupTerseUpdate(); | 1699 | group.SendGroupTerseUpdate(); |
1700 | } | 1700 | } |
1701 | } | 1701 | } |
1702 | 1702 | */ | |
1703 | /// <summary> | 1703 | /// <summary> |
1704 | /// Start spinning the given object | 1704 | /// Start spinning the given object |
1705 | /// </summary> | 1705 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index df6a1cf..b7c5b6b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -2078,7 +2078,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2078 | 2078 | ||
2079 | Scene.ForEachScenePresence(delegate(ScenePresence avatar) | 2079 | Scene.ForEachScenePresence(delegate(ScenePresence avatar) |
2080 | { | 2080 | { |
2081 | if (!avatar.IsChildAgent && avatar.ParentID == LocalId) | 2081 | if (!avatar.IsChildAgent && avatar.ParentID == part.LocalId && avatar.ParentUUID == UUID.Zero) |
2082 | avatar.StandUp(); | 2082 | avatar.StandUp(); |
2083 | 2083 | ||
2084 | if (!silent) | 2084 | if (!silent) |
@@ -2092,6 +2092,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2092 | { | 2092 | { |
2093 | // Send a kill object immediately | 2093 | // Send a kill object immediately |
2094 | avatar.ControllingClient.SendKillObject(new List<uint> { part.LocalId }); | 2094 | avatar.ControllingClient.SendKillObject(new List<uint> { part.LocalId }); |
2095 | //direct enqueue another delayed kill | ||
2096 | avatar.ControllingClient.SendEntityUpdate(part,PrimUpdateFlags.Kill); | ||
2095 | } | 2097 | } |
2096 | } | 2098 | } |
2097 | } | 2099 | } |
@@ -2110,6 +2112,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2110 | d.AddActiveScripts(count); | 2112 | d.AddActiveScripts(count); |
2111 | } | 2113 | } |
2112 | 2114 | ||
2115 | private const scriptEvents PhysicsNeeedSubsEvents = ( | ||
2116 | scriptEvents.collision | scriptEvents.collision_start | scriptEvents.collision_end | | ||
2117 | scriptEvents.land_collision | scriptEvents.land_collision_start | scriptEvents.land_collision_end); | ||
2118 | |||
2119 | private scriptEvents lastRootPartPhysEvents = 0; | ||
2120 | |||
2113 | public void aggregateScriptEvents() | 2121 | public void aggregateScriptEvents() |
2114 | { | 2122 | { |
2115 | PrimFlags objectflagupdate = (PrimFlags)RootPart.GetEffectiveObjectFlags(); | 2123 | PrimFlags objectflagupdate = (PrimFlags)RootPart.GetEffectiveObjectFlags(); |
@@ -2146,6 +2154,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
2146 | m_scene.RemoveGroupTarget(this); | 2154 | m_scene.RemoveGroupTarget(this); |
2147 | } | 2155 | } |
2148 | 2156 | ||
2157 | scriptEvents rootPartPhysEvents = RootPart.AggregateScriptEvents; | ||
2158 | rootPartPhysEvents &= PhysicsNeeedSubsEvents; | ||
2159 | if (rootPartPhysEvents != lastRootPartPhysEvents) | ||
2160 | { | ||
2161 | lastRootPartPhysEvents = rootPartPhysEvents; | ||
2162 | for (int i = 0; i < parts.Length; i++) | ||
2163 | { | ||
2164 | SceneObjectPart part = parts[i]; | ||
2165 | if (part == null) | ||
2166 | continue; | ||
2167 | part.UpdatePhysicsSubscribedEvents(); | ||
2168 | } | ||
2169 | } | ||
2170 | |||
2149 | ScheduleGroupForFullUpdate(); | 2171 | ScheduleGroupForFullUpdate(); |
2150 | } | 2172 | } |
2151 | 2173 | ||
@@ -2174,7 +2196,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2174 | // Apply physics to the root prim | 2196 | // Apply physics to the root prim |
2175 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, true); | 2197 | m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, true); |
2176 | 2198 | ||
2177 | |||
2178 | for (int i = 0; i < parts.Length; i++) | 2199 | for (int i = 0; i < parts.Length; i++) |
2179 | { | 2200 | { |
2180 | SceneObjectPart part = parts[i]; | 2201 | SceneObjectPart part = parts[i]; |
@@ -2242,10 +2263,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2242 | // any exception propogate upwards. | 2263 | // any exception propogate upwards. |
2243 | try | 2264 | try |
2244 | { | 2265 | { |
2245 | if (!m_scene.ShuttingDown || // if shutting down then there will be nothing to handle the return so leave till next restart | 2266 | // if shutting down then there will be nothing to handle the return so leave till next restart |
2246 | !m_scene.LoginsEnabled || // We're starting up or doing maintenance, don't mess with things | 2267 | if (!m_scene.ShuttingDown && |
2247 | m_scene.LoadingPrims) // Land may not be valid yet | 2268 | m_scene.LoginsEnabled && // We're starting up or doing maintenance, don't mess with things |
2248 | 2269 | !m_scene.LoadingPrims) // Land may not be valid yet | |
2249 | { | 2270 | { |
2250 | ILandObject parcel = m_scene.LandChannel.GetLandObject( | 2271 | ILandObject parcel = m_scene.LandChannel.GetLandObject( |
2251 | m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y); | 2272 | m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y); |
@@ -3345,7 +3366,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3345 | // engine about the delink. Someday, linksets should be made first | 3366 | // engine about the delink. Someday, linksets should be made first |
3346 | // class objects in the physics engine interface). | 3367 | // class objects in the physics engine interface). |
3347 | if (linkPartPa != null) | 3368 | if (linkPartPa != null) |
3369 | { | ||
3348 | m_scene.PhysicsScene.RemovePrim(linkPartPa); | 3370 | m_scene.PhysicsScene.RemovePrim(linkPartPa); |
3371 | linkPart.PhysActor = null; | ||
3372 | } | ||
3349 | 3373 | ||
3350 | // We need to reset the child part's position | 3374 | // We need to reset the child part's position |
3351 | // ready for life as a separate object after being a part of another object | 3375 | // ready for life as a separate object after being a part of another object |
@@ -3397,10 +3421,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3397 | public virtual void DetachFromBackup() | 3421 | public virtual void DetachFromBackup() |
3398 | { | 3422 | { |
3399 | if (m_scene != null) | 3423 | if (m_scene != null) |
3424 | { | ||
3400 | m_scene.SceneGraph.FireDetachFromBackup(this); | 3425 | m_scene.SceneGraph.FireDetachFromBackup(this); |
3401 | if (Backup && Scene != null) | 3426 | if (Backup) |
3402 | m_scene.EventManager.OnBackup -= ProcessBackup; | 3427 | m_scene.EventManager.OnBackup -= ProcessBackup; |
3403 | 3428 | } | |
3404 | Backup = false; | 3429 | Backup = false; |
3405 | } | 3430 | } |
3406 | 3431 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 01a323e..fcc3463 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -345,6 +345,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
345 | private string m_text = String.Empty; | 345 | private string m_text = String.Empty; |
346 | private string m_touchName = String.Empty; | 346 | private string m_touchName = String.Empty; |
347 | private UndoRedoState m_UndoRedo = null; | 347 | private UndoRedoState m_UndoRedo = null; |
348 | private object m_UndoLock = new object(); | ||
348 | 349 | ||
349 | private bool m_passTouches = false; | 350 | private bool m_passTouches = false; |
350 | private bool m_passCollisions = false; | 351 | private bool m_passCollisions = false; |
@@ -399,13 +400,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
399 | 400 | ||
400 | 401 | ||
401 | // 0 for default collision sounds, -1 for script disabled sound 1 for script defined sound | 402 | // 0 for default collision sounds, -1 for script disabled sound 1 for script defined sound |
402 | private sbyte m_collisionSoundType; | 403 | private sbyte m_collisionSoundType = 0; |
403 | private UUID m_collisionSound; | 404 | private UUID m_collisionSound; |
404 | private float m_collisionSoundVolume; | 405 | private float m_collisionSoundVolume; |
405 | 406 | ||
406 | private int LastColSoundSentTime; | 407 | private int LastColSoundSentTime; |
407 | 408 | ||
408 | |||
409 | private SOPVehicle m_vehicleParams = null; | 409 | private SOPVehicle m_vehicleParams = null; |
410 | 410 | ||
411 | public KeyframeMotion KeyframeMotion | 411 | public KeyframeMotion KeyframeMotion |
@@ -1534,7 +1534,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1534 | else | 1534 | else |
1535 | m_collisionSoundType = 1; | 1535 | m_collisionSoundType = 1; |
1536 | 1536 | ||
1537 | aggregateScriptEvents(); | ||
1538 | } | 1537 | } |
1539 | } | 1538 | } |
1540 | 1539 | ||
@@ -2164,7 +2163,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2164 | UpdatePhysicsSubscribedEvents(); // not sure if appliable here | 2163 | UpdatePhysicsSubscribedEvents(); // not sure if appliable here |
2165 | } | 2164 | } |
2166 | else | 2165 | else |
2166 | { | ||
2167 | PhysActor = null; // just to be sure | 2167 | PhysActor = null; // just to be sure |
2168 | RemFlag(PrimFlags.CameraDecoupled); | ||
2169 | } | ||
2168 | } | 2170 | } |
2169 | } | 2171 | } |
2170 | 2172 | ||
@@ -3539,6 +3541,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3539 | set | 3541 | set |
3540 | { | 3542 | { |
3541 | m_vehicleParams = value; | 3543 | m_vehicleParams = value; |
3544 | |||
3542 | } | 3545 | } |
3543 | } | 3546 | } |
3544 | 3547 | ||
@@ -3583,7 +3586,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3583 | 3586 | ||
3584 | m_vehicleParams.ProcessVehicleFlags(param, remove); | 3587 | m_vehicleParams.ProcessVehicleFlags(param, remove); |
3585 | 3588 | ||
3586 | if (_parentID ==0 && PhysActor != null) | 3589 | if (_parentID == 0 && PhysActor != null) |
3587 | { | 3590 | { |
3588 | PhysActor.VehicleFlags(param, remove); | 3591 | PhysActor.VehicleFlags(param, remove); |
3589 | } | 3592 | } |
@@ -3932,11 +3935,11 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3932 | 3935 | ||
3933 | public void StoreUndoState(ObjectChangeType change) | 3936 | public void StoreUndoState(ObjectChangeType change) |
3934 | { | 3937 | { |
3935 | if (m_UndoRedo == null) | 3938 | lock (m_UndoLock) |
3936 | m_UndoRedo = new UndoRedoState(5); | ||
3937 | |||
3938 | lock (m_UndoRedo) | ||
3939 | { | 3939 | { |
3940 | if (m_UndoRedo == null) | ||
3941 | m_UndoRedo = new UndoRedoState(5); | ||
3942 | |||
3940 | if (!Undoing && !IgnoreUndoUpdate && ParentGroup != null) // just to read better - undo is in progress, or suspended | 3943 | if (!Undoing && !IgnoreUndoUpdate && ParentGroup != null) // just to read better - undo is in progress, or suspended |
3941 | { | 3944 | { |
3942 | m_UndoRedo.StoreUndo(this, change); | 3945 | m_UndoRedo.StoreUndo(this, change); |
@@ -3959,11 +3962,11 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3959 | 3962 | ||
3960 | public void Undo() | 3963 | public void Undo() |
3961 | { | 3964 | { |
3962 | if (m_UndoRedo == null || Undoing || ParentGroup == null) | 3965 | lock (m_UndoLock) |
3963 | return; | ||
3964 | |||
3965 | lock (m_UndoRedo) | ||
3966 | { | 3966 | { |
3967 | if (m_UndoRedo == null || Undoing || ParentGroup == null) | ||
3968 | return; | ||
3969 | |||
3967 | Undoing = true; | 3970 | Undoing = true; |
3968 | m_UndoRedo.Undo(this); | 3971 | m_UndoRedo.Undo(this); |
3969 | Undoing = false; | 3972 | Undoing = false; |
@@ -3972,11 +3975,11 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3972 | 3975 | ||
3973 | public void Redo() | 3976 | public void Redo() |
3974 | { | 3977 | { |
3975 | if (m_UndoRedo == null || Undoing || ParentGroup == null) | 3978 | lock (m_UndoLock) |
3976 | return; | ||
3977 | |||
3978 | lock (m_UndoRedo) | ||
3979 | { | 3979 | { |
3980 | if (m_UndoRedo == null || Undoing || ParentGroup == null) | ||
3981 | return; | ||
3982 | |||
3980 | Undoing = true; | 3983 | Undoing = true; |
3981 | m_UndoRedo.Redo(this); | 3984 | m_UndoRedo.Redo(this); |
3982 | Undoing = false; | 3985 | Undoing = false; |
@@ -3985,11 +3988,11 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3985 | 3988 | ||
3986 | public void ClearUndoState() | 3989 | public void ClearUndoState() |
3987 | { | 3990 | { |
3988 | if (m_UndoRedo == null || Undoing) | 3991 | lock (m_UndoLock) |
3989 | return; | ||
3990 | |||
3991 | lock (m_UndoRedo) | ||
3992 | { | 3992 | { |
3993 | if (m_UndoRedo == null || Undoing) | ||
3994 | return; | ||
3995 | |||
3993 | m_UndoRedo.Clear(); | 3996 | m_UndoRedo.Clear(); |
3994 | } | 3997 | } |
3995 | } | 3998 | } |
@@ -4722,9 +4725,16 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
4722 | if (VolumeDetectActive) // change if not the default only | 4725 | if (VolumeDetectActive) // change if not the default only |
4723 | pa.SetVolumeDetect(1); | 4726 | pa.SetVolumeDetect(1); |
4724 | 4727 | ||
4725 | if (m_vehicleParams != null && LocalId == ParentGroup.RootPart.LocalId) | 4728 | if (m_vehicleParams != null && m_localId == ParentGroup.RootPart.LocalId) |
4729 | { | ||
4726 | m_vehicleParams.SetVehicle(pa); | 4730 | m_vehicleParams.SetVehicle(pa); |
4727 | 4731 | if(isPhysical && !isPhantom && m_vehicleParams.CameraDecoupled) | |
4732 | AddFlag(PrimFlags.CameraDecoupled); | ||
4733 | else | ||
4734 | RemFlag(PrimFlags.CameraDecoupled); | ||
4735 | } | ||
4736 | else | ||
4737 | RemFlag(PrimFlags.CameraDecoupled); | ||
4728 | // we are going to tell rest of code about physics so better have this here | 4738 | // we are going to tell rest of code about physics so better have this here |
4729 | PhysActor = pa; | 4739 | PhysActor = pa; |
4730 | 4740 | ||
@@ -4800,6 +4810,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
4800 | 4810 | ||
4801 | ParentGroup.Scene.EventManager.TriggerObjectRemovedFromPhysicalScene(this); | 4811 | ParentGroup.Scene.EventManager.TriggerObjectRemovedFromPhysicalScene(this); |
4802 | } | 4812 | } |
4813 | RemFlag(PrimFlags.CameraDecoupled); | ||
4803 | PhysActor = null; | 4814 | PhysActor = null; |
4804 | } | 4815 | } |
4805 | 4816 | ||
@@ -5021,7 +5032,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5021 | } | 5032 | } |
5022 | 5033 | ||
5023 | 5034 | ||
5024 | private void UpdatePhysicsSubscribedEvents() | 5035 | internal void UpdatePhysicsSubscribedEvents() |
5025 | { | 5036 | { |
5026 | PhysicsActor pa = PhysActor; | 5037 | PhysicsActor pa = PhysActor; |
5027 | if (pa == null) | 5038 | if (pa == null) |
@@ -5095,8 +5106,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5095 | objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop; | 5106 | objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop; |
5096 | } | 5107 | } |
5097 | 5108 | ||
5098 | UpdatePhysicsSubscribedEvents(); | ||
5099 | |||
5100 | LocalFlags = (PrimFlags)objectflagupdate; | 5109 | LocalFlags = (PrimFlags)objectflagupdate; |
5101 | 5110 | ||
5102 | if (ParentGroup != null && ParentGroup.RootPart == this) | 5111 | if (ParentGroup != null && ParentGroup.RootPart == this) |
@@ -5107,6 +5116,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5107 | { | 5116 | { |
5108 | // m_log.DebugFormat( | 5117 | // m_log.DebugFormat( |
5109 | // "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId); | 5118 | // "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId); |
5119 | UpdatePhysicsSubscribedEvents(); | ||
5110 | ScheduleFullUpdate(); | 5120 | ScheduleFullUpdate(); |
5111 | } | 5121 | } |
5112 | } | 5122 | } |
@@ -5408,5 +5418,24 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5408 | Acceleration = Vector3.Zero; | 5418 | Acceleration = Vector3.Zero; |
5409 | APIDActive = false; | 5419 | APIDActive = false; |
5410 | } | 5420 | } |
5421 | |||
5422 | // handle osVolumeDetect | ||
5423 | public void ScriptSetVolumeDetect(bool makeVolumeDetect) | ||
5424 | { | ||
5425 | if(_parentID == 0) | ||
5426 | { | ||
5427 | // if root prim do it via SOG | ||
5428 | ParentGroup.ScriptSetVolumeDetect(makeVolumeDetect); | ||
5429 | return; | ||
5430 | } | ||
5431 | |||
5432 | bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0); | ||
5433 | bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0); | ||
5434 | bool wasPhantom = ((Flags & PrimFlags.Phantom) != 0); | ||
5435 | |||
5436 | if(PhysActor != null) | ||
5437 | PhysActor.Building = true; | ||
5438 | UpdatePrimFlags(wasUsingPhysics,wasTemporary,wasPhantom,makeVolumeDetect,false); | ||
5439 | } | ||
5411 | } | 5440 | } |
5412 | } | 5441 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 732d5ef..cb7422b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -542,10 +542,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
542 | 542 | ||
543 | public Vector3 CameraPosition { get; set; } | 543 | public Vector3 CameraPosition { get; set; } |
544 | 544 | ||
545 | public Quaternion CameraRotation | 545 | public Quaternion CameraRotation { get; private set; } |
546 | { | ||
547 | get { return Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis); } | ||
548 | } | ||
549 | 546 | ||
550 | // Use these three vectors to figure out what the agent is looking at | 547 | // Use these three vectors to figure out what the agent is looking at |
551 | // Convert it to a Matrix and/or Quaternion | 548 | // Convert it to a Matrix and/or Quaternion |
@@ -1242,6 +1239,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1242 | ParentPart = part; | 1239 | ParentPart = part; |
1243 | m_pos = PrevSitOffset; | 1240 | m_pos = PrevSitOffset; |
1244 | pos = part.GetWorldPosition(); | 1241 | pos = part.GetWorldPosition(); |
1242 | PhysicsActor partPhysActor = part.PhysActor; | ||
1243 | if(partPhysActor != null) | ||
1244 | { | ||
1245 | partPhysActor.OnPhysicsRequestingCameraData -= | ||
1246 | physActor_OnPhysicsRequestingCameraData; | ||
1247 | partPhysActor.OnPhysicsRequestingCameraData += | ||
1248 | physActor_OnPhysicsRequestingCameraData; | ||
1249 | } | ||
1245 | } | 1250 | } |
1246 | ParentUUID = UUID.Zero; | 1251 | ParentUUID = UUID.Zero; |
1247 | } | 1252 | } |
@@ -1922,6 +1927,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
1922 | return true; | 1927 | return true; |
1923 | } | 1928 | } |
1924 | 1929 | ||
1930 | public void RotateToLookAt(Vector3 lookAt) | ||
1931 | { | ||
1932 | if(ParentID == 0) | ||
1933 | { | ||
1934 | float n = lookAt.X * lookAt.X + lookAt.Y * lookAt.Y; | ||
1935 | if(n < 0.0001f) | ||
1936 | { | ||
1937 | Rotation = Quaternion.Identity; | ||
1938 | return; | ||
1939 | } | ||
1940 | n = lookAt.X/(float)Math.Sqrt(n); | ||
1941 | float angle = (float)Math.Acos(n); | ||
1942 | angle *= 0.5f; | ||
1943 | float s = (float)Math.Sin(angle); | ||
1944 | if(lookAt.Y < 0) | ||
1945 | s = -s; | ||
1946 | Rotation = new Quaternion( | ||
1947 | 0f, | ||
1948 | 0f, | ||
1949 | s, | ||
1950 | (float)Math.Cos(angle) | ||
1951 | ); | ||
1952 | } | ||
1953 | } | ||
1954 | |||
1925 | /// <summary> | 1955 | /// <summary> |
1926 | /// Complete Avatar's movement into the region. | 1956 | /// Complete Avatar's movement into the region. |
1927 | /// </summary> | 1957 | /// </summary> |
@@ -1958,10 +1988,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1958 | bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | 1988 | bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); |
1959 | 1989 | ||
1960 | Vector3 look = Lookat; | 1990 | Vector3 look = Lookat; |
1991 | look.Z = 0f; | ||
1961 | if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01)) | 1992 | if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01)) |
1962 | { | 1993 | { |
1963 | look = Velocity; | 1994 | look = Velocity; |
1964 | look.Z = 0; | ||
1965 | look.Normalize(); | 1995 | look.Normalize(); |
1966 | if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01) ) | 1996 | if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01) ) |
1967 | look = new Vector3(0.99f, 0.042f, 0); | 1997 | look = new Vector3(0.99f, 0.042f, 0); |
@@ -1995,11 +2025,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1995 | m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); | 2025 | m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); |
1996 | } | 2026 | } |
1997 | 2027 | ||
2028 | if(!gotCrossUpdate) | ||
2029 | RotateToLookAt(look); | ||
1998 | 2030 | ||
1999 | // Tell the client that we're totally ready | 2031 | // Tell the client that we're totally ready |
2000 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); | 2032 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); |
2001 | 2033 | ||
2002 | |||
2003 | m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 2034 | m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
2004 | 2035 | ||
2005 | if (!string.IsNullOrEmpty(m_callbackURI)) | 2036 | if (!string.IsNullOrEmpty(m_callbackURI)) |
@@ -2696,9 +2727,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2696 | CameraPosition = agentData.CameraCenter; | 2727 | CameraPosition = agentData.CameraCenter; |
2697 | // Use these three vectors to figure out what the agent is looking at | 2728 | // Use these three vectors to figure out what the agent is looking at |
2698 | // Convert it to a Matrix and/or Quaternion | 2729 | // Convert it to a Matrix and/or Quaternion |
2730 | |||
2731 | // this my need lock | ||
2699 | CameraAtAxis = agentData.CameraAtAxis; | 2732 | CameraAtAxis = agentData.CameraAtAxis; |
2700 | CameraLeftAxis = agentData.CameraLeftAxis; | 2733 | CameraLeftAxis = agentData.CameraLeftAxis; |
2701 | CameraUpAxis = agentData.CameraUpAxis; | 2734 | CameraUpAxis = agentData.CameraUpAxis; |
2735 | Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis); | ||
2736 | CameraRotation = camRot; | ||
2702 | 2737 | ||
2703 | // The Agent's Draw distance setting | 2738 | // The Agent's Draw distance setting |
2704 | // When we get to the point of re-computing neighbors everytime this | 2739 | // When we get to the point of re-computing neighbors everytime this |
@@ -3171,9 +3206,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3171 | offset = offset * part.RotationOffset; | 3206 | offset = offset * part.RotationOffset; |
3172 | offset += part.OffsetPosition; | 3207 | offset += part.OffsetPosition; |
3173 | 3208 | ||
3174 | if (CameraAtAxis == Vector3.Zero && cameraEyeOffset == Vector3.Zero) | 3209 | if (cameraAtOffset == Vector3.Zero && cameraEyeOffset == Vector3.Zero) |
3175 | { | 3210 | { |
3176 | CameraAtAxis = part.ParentGroup.RootPart.GetCameraAtOffset(); | 3211 | cameraAtOffset = part.ParentGroup.RootPart.GetCameraAtOffset(); |
3177 | cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset(); | 3212 | cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset(); |
3178 | } | 3213 | } |
3179 | else | 3214 | else |
@@ -3304,7 +3339,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3304 | Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); | 3339 | Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); |
3305 | bool forceMouselook = part.GetForceMouselook(); | 3340 | bool forceMouselook = part.GetForceMouselook(); |
3306 | 3341 | ||
3307 | m_bodyRot = Orientation; | ||
3308 | 3342 | ||
3309 | if (!part.IsRoot) | 3343 | if (!part.IsRoot) |
3310 | { | 3344 | { |
@@ -3312,9 +3346,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3312 | offset = offset * part.RotationOffset; | 3346 | offset = offset * part.RotationOffset; |
3313 | offset += part.OffsetPosition; | 3347 | offset += part.OffsetPosition; |
3314 | 3348 | ||
3315 | if (CameraAtAxis == Vector3.Zero && cameraEyeOffset == Vector3.Zero) | 3349 | if (cameraAtOffset == Vector3.Zero && cameraEyeOffset == Vector3.Zero) |
3316 | { | 3350 | { |
3317 | CameraAtAxis = part.ParentGroup.RootPart.GetCameraAtOffset(); | 3351 | cameraAtOffset = part.ParentGroup.RootPart.GetCameraAtOffset(); |
3318 | cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset(); | 3352 | cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset(); |
3319 | } | 3353 | } |
3320 | else | 3354 | else |
@@ -3326,6 +3360,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3326 | } | 3360 | } |
3327 | } | 3361 | } |
3328 | 3362 | ||
3363 | m_bodyRot = Orientation; | ||
3329 | m_pos = offset; | 3364 | m_pos = offset; |
3330 | 3365 | ||
3331 | ControllingClient.SendSitResponse( | 3366 | ControllingClient.SendSitResponse( |
@@ -4571,6 +4606,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
4571 | CameraAtAxis = cAgent.AtAxis; | 4606 | CameraAtAxis = cAgent.AtAxis; |
4572 | CameraLeftAxis = cAgent.LeftAxis; | 4607 | CameraLeftAxis = cAgent.LeftAxis; |
4573 | CameraUpAxis = cAgent.UpAxis; | 4608 | CameraUpAxis = cAgent.UpAxis; |
4609 | |||
4610 | Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis); | ||
4611 | CameraRotation = camRot; | ||
4612 | |||
4613 | |||
4574 | ParentUUID = cAgent.ParentPart; | 4614 | ParentUUID = cAgent.ParentPart; |
4575 | PrevSitOffset = cAgent.SitOffset; | 4615 | PrevSitOffset = cAgent.SitOffset; |
4576 | 4616 | ||
@@ -5429,10 +5469,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
5429 | } | 5469 | } |
5430 | } | 5470 | } |
5431 | 5471 | ||
5472 | CameraData physActor_OnPhysicsRequestingCameraData() | ||
5473 | { | ||
5474 | return new CameraData | ||
5475 | { | ||
5476 | Valid = true, | ||
5477 | MouseLook = this.m_mouseLook, | ||
5478 | CameraRotation = this.CameraRotation, | ||
5479 | CameraAtAxis = this.CameraAtAxis | ||
5480 | }; | ||
5481 | } | ||
5482 | |||
5432 | public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, UUID Script_item_UUID) | 5483 | public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, UUID Script_item_UUID) |
5433 | { | 5484 | { |
5434 | SceneObjectPart p = m_scene.GetSceneObjectPart(Obj_localID); | 5485 | SceneObjectPart part = m_scene.GetSceneObjectPart(Obj_localID); |
5435 | if (p == null) | 5486 | if (part == null) |
5436 | return; | 5487 | return; |
5437 | 5488 | ||
5438 | ControllingClient.SendTakeControls(controls, false, false); | 5489 | ControllingClient.SendTakeControls(controls, false, false); |
@@ -5442,7 +5493,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5442 | obj.ignoreControls = ScriptControlled.CONTROL_ZERO; | 5493 | obj.ignoreControls = ScriptControlled.CONTROL_ZERO; |
5443 | obj.eventControls = ScriptControlled.CONTROL_ZERO; | 5494 | obj.eventControls = ScriptControlled.CONTROL_ZERO; |
5444 | 5495 | ||
5445 | obj.objectID = p.ParentGroup.UUID; | 5496 | obj.objectID = part.ParentGroup.UUID; |
5446 | obj.itemID = Script_item_UUID; | 5497 | obj.itemID = Script_item_UUID; |
5447 | if (pass_on == 0 && accept == 0) | 5498 | if (pass_on == 0 && accept == 0) |
5448 | { | 5499 | { |
@@ -5470,17 +5521,43 @@ namespace OpenSim.Region.Framework.Scenes | |||
5470 | { | 5521 | { |
5471 | IgnoredControls &= ~(ScriptControlled)controls; | 5522 | IgnoredControls &= ~(ScriptControlled)controls; |
5472 | if (scriptedcontrols.ContainsKey(Script_item_UUID)) | 5523 | if (scriptedcontrols.ContainsKey(Script_item_UUID)) |
5473 | scriptedcontrols.Remove(Script_item_UUID); | 5524 | RemoveScriptFromControlNotifications(Script_item_UUID, part); |
5474 | } | 5525 | } |
5475 | else | 5526 | else |
5476 | { | 5527 | { |
5477 | scriptedcontrols[Script_item_UUID] = obj; | 5528 | AddScriptToControlNotifications(Script_item_UUID, part, ref obj); |
5478 | } | 5529 | } |
5479 | } | 5530 | } |
5480 | 5531 | ||
5481 | ControllingClient.SendTakeControls(controls, pass_on == 1 ? true : false, true); | 5532 | ControllingClient.SendTakeControls(controls, pass_on == 1 ? true : false, true); |
5482 | } | 5533 | } |
5483 | 5534 | ||
5535 | private void AddScriptToControlNotifications(OpenMetaverse.UUID Script_item_UUID, SceneObjectPart part, ref ScriptControllers obj) | ||
5536 | { | ||
5537 | scriptedcontrols[Script_item_UUID] = obj; | ||
5538 | |||
5539 | PhysicsActor physActor = part.ParentGroup.RootPart.PhysActor; | ||
5540 | if (physActor != null) | ||
5541 | { | ||
5542 | physActor.OnPhysicsRequestingCameraData -= physActor_OnPhysicsRequestingCameraData; | ||
5543 | physActor.OnPhysicsRequestingCameraData += physActor_OnPhysicsRequestingCameraData; | ||
5544 | } | ||
5545 | } | ||
5546 | |||
5547 | private void RemoveScriptFromControlNotifications(OpenMetaverse.UUID Script_item_UUID, SceneObjectPart part) | ||
5548 | { | ||
5549 | scriptedcontrols.Remove(Script_item_UUID); | ||
5550 | |||
5551 | if (part != null) | ||
5552 | { | ||
5553 | PhysicsActor physActor = part.ParentGroup.RootPart.PhysActor; | ||
5554 | if (physActor != null) | ||
5555 | { | ||
5556 | physActor.OnPhysicsRequestingCameraData -= physActor_OnPhysicsRequestingCameraData; | ||
5557 | } | ||
5558 | } | ||
5559 | } | ||
5560 | |||
5484 | public void HandleForceReleaseControls(IClientAPI remoteClient, UUID agentID) | 5561 | public void HandleForceReleaseControls(IClientAPI remoteClient, UUID agentID) |
5485 | { | 5562 | { |
5486 | IgnoredControls = ScriptControlled.CONTROL_ZERO; | 5563 | IgnoredControls = ScriptControlled.CONTROL_ZERO; |
@@ -5518,6 +5595,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5518 | public void UnRegisterControlEventsToScript(uint Obj_localID, UUID Script_item_UUID) | 5595 | public void UnRegisterControlEventsToScript(uint Obj_localID, UUID Script_item_UUID) |
5519 | { | 5596 | { |
5520 | ScriptControllers takecontrols; | 5597 | ScriptControllers takecontrols; |
5598 | SceneObjectPart part = m_scene.GetSceneObjectPart(Obj_localID); | ||
5521 | 5599 | ||
5522 | lock (scriptedcontrols) | 5600 | lock (scriptedcontrols) |
5523 | { | 5601 | { |
@@ -5528,7 +5606,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5528 | ControllingClient.SendTakeControls((int)sctc, false, false); | 5606 | ControllingClient.SendTakeControls((int)sctc, false, false); |
5529 | ControllingClient.SendTakeControls((int)sctc, true, false); | 5607 | ControllingClient.SendTakeControls((int)sctc, true, false); |
5530 | 5608 | ||
5531 | scriptedcontrols.Remove(Script_item_UUID); | 5609 | RemoveScriptFromControlNotifications(Script_item_UUID, part); |
5532 | IgnoredControls = ScriptControlled.CONTROL_ZERO; | 5610 | IgnoredControls = ScriptControlled.CONTROL_ZERO; |
5533 | foreach (ScriptControllers scData in scriptedcontrols.Values) | 5611 | foreach (ScriptControllers scData in scriptedcontrols.Values) |
5534 | { | 5612 | { |
@@ -5947,6 +6025,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5947 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)) | 6025 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)) |
5948 | { | 6026 | { |
5949 | pos = land.LandData.UserLocation; | 6027 | pos = land.LandData.UserLocation; |
6028 | positionChanged = true; | ||
5950 | } | 6029 | } |
5951 | } | 6030 | } |
5952 | 6031 | ||