diff options
author | UbitUmarov | 2016-09-17 12:44:52 +0100 |
---|---|---|
committer | UbitUmarov | 2016-09-17 12:44:52 +0100 |
commit | e5383604cb68710b1f9960d6a0aeb0812d2db3ea (patch) | |
tree | 844cb56f494c58c123cd167280673dae58f89f16 /OpenSim/Region/Framework/Scenes | |
parent | forgot the dll (diff) | |
parent | change spinobject math, and a few minor things (diff) | |
download | opensim-SC-e5383604cb68710b1f9960d6a0aeb0812d2db3ea.zip opensim-SC-e5383604cb68710b1f9960d6a0aeb0812d2db3ea.tar.gz opensim-SC-e5383604cb68710b1f9960d6a0aeb0812d2db3ea.tar.bz2 opensim-SC-e5383604cb68710b1f9960d6a0aeb0812d2db3ea.tar.xz |
Merge branch 'master' into httptests
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 75 | ||||
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 10 | ||||
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 66 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 101 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 40 |
6 files changed, 154 insertions, 140 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 8683599..6ff3049 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -1881,7 +1881,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1881 | catch (Exception e) | 1881 | catch (Exception e) |
1882 | { | 1882 | { |
1883 | m_log.ErrorFormat( | 1883 | m_log.ErrorFormat( |
1884 | "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}", | 1884 | "[EVENT MANAGER]: Delegate for TriggerGroupMove failed - continuing. {0} {1}", |
1885 | e.Message, e.StackTrace); | 1885 | e.Message, e.StackTrace); |
1886 | } | 1886 | } |
1887 | } | 1887 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 4d491d1..a5abe76 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -340,13 +340,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
340 | obj.ObjectGrabHandler(localID, offsetPos, remoteClient); | 340 | obj.ObjectGrabHandler(localID, offsetPos, remoteClient); |
341 | 341 | ||
342 | // If the touched prim handles touches, deliver it | 342 | // If the touched prim handles touches, deliver it |
343 | // If not, deliver to root prim | ||
344 | if ((part.ScriptEvents & scriptEvents.touch_start) != 0) | 343 | if ((part.ScriptEvents & scriptEvents.touch_start) != 0) |
345 | EventManager.TriggerObjectGrab(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg); | 344 | EventManager.TriggerObjectGrab(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg); |
346 | 345 | ||
347 | // Deliver to the root prim if the touched prim doesn't handle touches | 346 | // Deliver to the root prim if the touched prim doesn't handle touches |
348 | // or if we're meant to pass on touches anyway. Don't send to root prim | 347 | // or if we're meant to pass on touches anyway. |
349 | // if prim touched is the root prim as we just did it | ||
350 | if (((part.ScriptEvents & scriptEvents.touch_start) == 0) || | 348 | if (((part.ScriptEvents & scriptEvents.touch_start) == 0) || |
351 | (part.PassTouches && (part.LocalId != obj.RootPart.LocalId))) | 349 | (part.PassTouches && (part.LocalId != obj.RootPart.LocalId))) |
352 | { | 350 | { |
@@ -381,12 +379,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
381 | surfaceArg = surfaceArgs[0]; | 379 | surfaceArg = surfaceArgs[0]; |
382 | 380 | ||
383 | // If the touched prim handles touches, deliver it | 381 | // If the touched prim handles touches, deliver it |
384 | // If not, deliver to root prim | ||
385 | if ((part.ScriptEvents & scriptEvents.touch) != 0) | 382 | if ((part.ScriptEvents & scriptEvents.touch) != 0) |
386 | EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg); | 383 | EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg); |
387 | // Deliver to the root prim if the touched prim doesn't handle touches | 384 | // Deliver to the root prim if the touched prim doesn't handle touches |
388 | // or if we're meant to pass on touches anyway. Don't send to root prim | 385 | // or if we're meant to pass on touches anyway. |
389 | // if prim touched is the root prim as we just did it | ||
390 | if (((part.ScriptEvents & scriptEvents.touch) == 0) || | 386 | if (((part.ScriptEvents & scriptEvents.touch) == 0) || |
391 | (part.PassTouches && (part.LocalId != group.RootPart.LocalId))) | 387 | (part.PassTouches && (part.LocalId != group.RootPart.LocalId))) |
392 | { | 388 | { |
@@ -400,18 +396,77 @@ namespace OpenSim.Region.Framework.Scenes | |||
400 | if (part == null) | 396 | if (part == null) |
401 | return; | 397 | return; |
402 | 398 | ||
403 | SceneObjectGroup obj = part.ParentGroup; | 399 | SceneObjectGroup grp = part.ParentGroup; |
404 | 400 | ||
405 | SurfaceTouchEventArgs surfaceArg = null; | 401 | SurfaceTouchEventArgs surfaceArg = null; |
406 | if (surfaceArgs != null && surfaceArgs.Count > 0) | 402 | if (surfaceArgs != null && surfaceArgs.Count > 0) |
407 | surfaceArg = surfaceArgs[0]; | 403 | surfaceArg = surfaceArgs[0]; |
408 | 404 | ||
409 | // If the touched prim handles touches, deliver it | 405 | // If the touched prim handles touches, deliver it |
410 | // If not, deliver to root prim | ||
411 | if ((part.ScriptEvents & scriptEvents.touch_end) != 0) | 406 | if ((part.ScriptEvents & scriptEvents.touch_end) != 0) |
412 | EventManager.TriggerObjectDeGrab(part.LocalId, 0, remoteClient, surfaceArg); | 407 | EventManager.TriggerObjectDeGrab(part.LocalId, 0, remoteClient, surfaceArg); |
413 | else | 408 | // if not or PassTouchs, send it also to root. |
414 | EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient, surfaceArg); | 409 | if (((part.ScriptEvents & scriptEvents.touch_end) == 0) || |
410 | (part.PassTouches && (part.LocalId != grp.RootPart.LocalId))) | ||
411 | { | ||
412 | EventManager.TriggerObjectDeGrab(grp.RootPart.LocalId, part.LocalId, remoteClient, surfaceArg); | ||
413 | } | ||
414 | } | ||
415 | |||
416 | /// <summary> | ||
417 | /// Start spinning the given object | ||
418 | /// </summary> | ||
419 | /// <param name="objectID"></param> | ||
420 | /// <param name="rotation"></param> | ||
421 | /// <param name="remoteClient"></param> | ||
422 | public virtual void ProcessSpinStart(UUID objectID, IClientAPI remoteClient) | ||
423 | { | ||
424 | SceneObjectGroup group = GetGroupByPrim(objectID); | ||
425 | if (group != null) | ||
426 | { | ||
427 | if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) | ||
428 | { | ||
429 | group.SpinStart(remoteClient); | ||
430 | } | ||
431 | } | ||
432 | } | ||
433 | |||
434 | /// <summary> | ||
435 | /// Spin the given object | ||
436 | /// </summary> | ||
437 | /// <param name="objectID"></param> | ||
438 | /// <param name="rotation"></param> | ||
439 | /// <param name="remoteClient"></param> | ||
440 | public virtual void ProcessSpinObject(UUID objectID, Quaternion rotation, IClientAPI remoteClient) | ||
441 | { | ||
442 | SceneObjectGroup group = GetGroupByPrim(objectID); | ||
443 | if (group != null) | ||
444 | { | ||
445 | if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) | ||
446 | { | ||
447 | group.SpinMovement(rotation, remoteClient); | ||
448 | } | ||
449 | // This is outside the above permissions condition | ||
450 | // so that if the object is locked the client moving the object | ||
451 | // get's it's position on the simulator even if it was the same as before | ||
452 | // This keeps the moving user's client in sync with the rest of the world. | ||
453 | group.SendGroupTerseUpdate(); | ||
454 | } | ||
455 | } | ||
456 | |||
457 | public virtual void ProcessSpinObjectStop(UUID objectID, IClientAPI remoteClient) | ||
458 | { | ||
459 | /* no op for now | ||
460 | SceneObjectGroup group = GetGroupByPrim(objectID); | ||
461 | if (group != null) | ||
462 | { | ||
463 | if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) | ||
464 | { | ||
465 | // group.SpinMovement(rotation, remoteClient); | ||
466 | } | ||
467 | group.SendGroupTerseUpdate(); | ||
468 | } | ||
469 | */ | ||
415 | } | 470 | } |
416 | 471 | ||
417 | public void ProcessScriptReset(IClientAPI remoteClient, UUID objectID, | 472 | public void ProcessScriptReset(IClientAPI remoteClient, UUID objectID, |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0d6af77..d77b8ae 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3329,8 +3329,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3329 | client.OnObjectRequest += RequestPrim; | 3329 | client.OnObjectRequest += RequestPrim; |
3330 | client.OnObjectSelect += SelectPrim; | 3330 | client.OnObjectSelect += SelectPrim; |
3331 | client.OnObjectDeselect += DeselectPrim; | 3331 | client.OnObjectDeselect += DeselectPrim; |
3332 | client.OnSpinStart += m_sceneGraph.SpinStart; | ||
3333 | client.OnSpinUpdate += m_sceneGraph.SpinObject; | ||
3334 | client.OnDeRezObject += DeRezObjects; | 3332 | client.OnDeRezObject += DeRezObjects; |
3335 | 3333 | ||
3336 | client.OnObjectName += m_sceneGraph.PrimName; | 3334 | client.OnObjectName += m_sceneGraph.PrimName; |
@@ -3346,6 +3344,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3346 | client.OnGrabObject += ProcessObjectGrab; | 3344 | client.OnGrabObject += ProcessObjectGrab; |
3347 | client.OnGrabUpdate += ProcessObjectGrabUpdate; | 3345 | client.OnGrabUpdate += ProcessObjectGrabUpdate; |
3348 | client.OnDeGrabObject += ProcessObjectDeGrab; | 3346 | client.OnDeGrabObject += ProcessObjectDeGrab; |
3347 | client.OnSpinStart += ProcessSpinStart; | ||
3348 | client.OnSpinUpdate += ProcessSpinObject; | ||
3349 | client.OnSpinStop += ProcessSpinObjectStop; | ||
3349 | client.OnUndo += m_sceneGraph.HandleUndo; | 3350 | client.OnUndo += m_sceneGraph.HandleUndo; |
3350 | client.OnRedo += m_sceneGraph.HandleRedo; | 3351 | client.OnRedo += m_sceneGraph.HandleRedo; |
3351 | client.OnObjectDescription += m_sceneGraph.PrimDescription; | 3352 | client.OnObjectDescription += m_sceneGraph.PrimDescription; |
@@ -3456,8 +3457,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3456 | client.OnObjectRequest -= RequestPrim; | 3457 | client.OnObjectRequest -= RequestPrim; |
3457 | client.OnObjectSelect -= SelectPrim; | 3458 | client.OnObjectSelect -= SelectPrim; |
3458 | client.OnObjectDeselect -= DeselectPrim; | 3459 | client.OnObjectDeselect -= DeselectPrim; |
3459 | client.OnSpinStart -= m_sceneGraph.SpinStart; | ||
3460 | client.OnSpinUpdate -= m_sceneGraph.SpinObject; | ||
3461 | client.OnDeRezObject -= DeRezObjects; | 3460 | client.OnDeRezObject -= DeRezObjects; |
3462 | client.OnObjectName -= m_sceneGraph.PrimName; | 3461 | client.OnObjectName -= m_sceneGraph.PrimName; |
3463 | client.OnObjectClickAction -= m_sceneGraph.PrimClickAction; | 3462 | client.OnObjectClickAction -= m_sceneGraph.PrimClickAction; |
@@ -3472,6 +3471,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3472 | client.OnGrabObject -= ProcessObjectGrab; | 3471 | client.OnGrabObject -= ProcessObjectGrab; |
3473 | client.OnGrabUpdate -= ProcessObjectGrabUpdate; | 3472 | client.OnGrabUpdate -= ProcessObjectGrabUpdate; |
3474 | client.OnDeGrabObject -= ProcessObjectDeGrab; | 3473 | client.OnDeGrabObject -= ProcessObjectDeGrab; |
3474 | client.OnSpinStart -= ProcessSpinStart; | ||
3475 | client.OnSpinUpdate -= ProcessSpinObject; | ||
3476 | client.OnSpinStop -= ProcessSpinObjectStop; | ||
3475 | client.OnUndo -= m_sceneGraph.HandleUndo; | 3477 | client.OnUndo -= m_sceneGraph.HandleUndo; |
3476 | client.OnRedo -= m_sceneGraph.HandleRedo; | 3478 | client.OnRedo -= m_sceneGraph.HandleRedo; |
3477 | client.OnObjectDescription -= m_sceneGraph.PrimDescription; | 3479 | client.OnObjectDescription -= m_sceneGraph.PrimDescription; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 0e5720f..77c66b6 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -1674,72 +1674,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1674 | } | 1674 | } |
1675 | } | 1675 | } |
1676 | } | 1676 | } |
1677 | /* moved to scene ProcessObjectGrabUpdate | ||
1678 | /// <summary> | ||
1679 | /// Move the given object | ||
1680 | /// </summary> | ||
1681 | /// <param name="objectID"></param> | ||
1682 | /// <param name="offset"></param> | ||
1683 | /// <param name="pos"></param> | ||
1684 | /// <param name="remoteClient"></param> | ||
1685 | protected internal void MoveObject(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) | ||
1686 | { | ||
1687 | SceneObjectGroup group = GetGroupByPrim(objectID); | ||
1688 | if (group != null) | ||
1689 | { | ||
1690 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) | ||
1691 | { | ||
1692 | group.GrabMovement(objectID, offset, pos, remoteClient); | ||
1693 | } | ||
1694 | |||
1695 | // This is outside the above permissions condition | ||
1696 | // so that if the object is locked the client moving the object | ||
1697 | // get's it's position on the simulator even if it was the same as before | ||
1698 | // This keeps the moving user's client in sync with the rest of the world. | ||
1699 | group.SendGroupTerseUpdate(); | ||
1700 | } | ||
1701 | } | ||
1702 | */ | ||
1703 | /// <summary> | ||
1704 | /// Start spinning the given object | ||
1705 | /// </summary> | ||
1706 | /// <param name="objectID"></param> | ||
1707 | /// <param name="rotation"></param> | ||
1708 | /// <param name="remoteClient"></param> | ||
1709 | protected internal void SpinStart(UUID objectID, IClientAPI remoteClient) | ||
1710 | { | ||
1711 | SceneObjectGroup group = GetGroupByPrim(objectID); | ||
1712 | if (group != null) | ||
1713 | { | ||
1714 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) | ||
1715 | { | ||
1716 | group.SpinStart(remoteClient); | ||
1717 | } | ||
1718 | } | ||
1719 | } | ||
1720 | |||
1721 | /// <summary> | ||
1722 | /// Spin the given object | ||
1723 | /// </summary> | ||
1724 | /// <param name="objectID"></param> | ||
1725 | /// <param name="rotation"></param> | ||
1726 | /// <param name="remoteClient"></param> | ||
1727 | protected internal void SpinObject(UUID objectID, Quaternion rotation, IClientAPI remoteClient) | ||
1728 | { | ||
1729 | SceneObjectGroup group = GetGroupByPrim(objectID); | ||
1730 | if (group != null) | ||
1731 | { | ||
1732 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) | ||
1733 | { | ||
1734 | group.SpinMovement(rotation, remoteClient); | ||
1735 | } | ||
1736 | // This is outside the above permissions condition | ||
1737 | // so that if the object is locked the client moving the object | ||
1738 | // get's it's position on the simulator even if it was the same as before | ||
1739 | // This keeps the moving user's client in sync with the rest of the world. | ||
1740 | group.SendGroupTerseUpdate(); | ||
1741 | } | ||
1742 | } | ||
1743 | 1677 | ||
1744 | /// <summary> | 1678 | /// <summary> |
1745 | /// | 1679 | /// |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index b7c5b6b..17dfb85 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -79,7 +79,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
79 | touch_end = 536870912, | 79 | touch_end = 536870912, |
80 | touch_start = 2097152, | 80 | touch_start = 2097152, |
81 | transaction_result = 33554432, | 81 | transaction_result = 33554432, |
82 | object_rez = 4194304 | 82 | object_rez = 4194304, |
83 | anytouch = touch | touch_end | touch_start | ||
83 | } | 84 | } |
84 | 85 | ||
85 | public struct scriptPosTarget | 86 | public struct scriptPosTarget |
@@ -3497,34 +3498,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
3497 | { | 3498 | { |
3498 | if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) | 3499 | if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) |
3499 | { | 3500 | { |
3501 | if (BlockGrabOverride) | ||
3502 | return; | ||
3503 | |||
3500 | SceneObjectPart part = GetPart(partID); | 3504 | SceneObjectPart part = GetPart(partID); |
3501 | 3505 | ||
3502 | if (part == null) | 3506 | if (part == null) |
3503 | return; | 3507 | return; |
3504 | 3508 | ||
3509 | if (part.BlockGrab) | ||
3510 | return; | ||
3511 | |||
3505 | PhysicsActor pa = m_rootPart.PhysActor; | 3512 | PhysicsActor pa = m_rootPart.PhysActor; |
3506 | 3513 | ||
3507 | if (pa != null) | 3514 | if (pa != null && pa.IsPhysical) |
3508 | { | 3515 | { |
3509 | if (pa.IsPhysical) | 3516 | // empirically convert distance diference to a impulse |
3510 | { | 3517 | Vector3 grabforce = pos - AbsolutePosition; |
3511 | if (!BlockGrabOverride && !part.BlockGrab) | 3518 | grabforce = grabforce * (pa.Mass * 0.1f); |
3512 | { | 3519 | pa.AddForce(grabforce, false); |
3513 | /* Vector3 llmoveforce = pos - AbsolutePosition; | 3520 | m_scene.PhysicsScene.AddPhysicsActorTaint(pa); |
3514 | Vector3 grabforce = llmoveforce; | ||
3515 | grabforce = (grabforce / 10) * pa.Mass; | ||
3516 | */ | ||
3517 | // empirically convert distance diference to a impulse | ||
3518 | Vector3 grabforce = pos - AbsolutePosition; | ||
3519 | grabforce = grabforce * (pa.Mass/ 10.0f); | ||
3520 | pa.AddForce(grabforce, false); | ||
3521 | m_scene.PhysicsScene.AddPhysicsActorTaint(pa); | ||
3522 | } | ||
3523 | } | ||
3524 | else | ||
3525 | { | ||
3526 | NonPhysicalGrabMovement(pos); | ||
3527 | } | ||
3528 | } | 3521 | } |
3529 | else | 3522 | else |
3530 | { | 3523 | { |
@@ -3553,6 +3546,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3553 | /// <param name="remoteClient"></param> | 3546 | /// <param name="remoteClient"></param> |
3554 | public void SpinStart(IClientAPI remoteClient) | 3547 | public void SpinStart(IClientAPI remoteClient) |
3555 | { | 3548 | { |
3549 | if (BlockGrabOverride || m_rootPart.BlockGrab) | ||
3550 | return; | ||
3556 | if (m_scene.EventManager.TriggerGroupSpinStart(UUID)) | 3551 | if (m_scene.EventManager.TriggerGroupSpinStart(UUID)) |
3557 | { | 3552 | { |
3558 | PhysicsActor pa = m_rootPart.PhysActor; | 3553 | PhysicsActor pa = m_rootPart.PhysActor; |
@@ -3600,46 +3595,48 @@ namespace OpenSim.Region.Framework.Scenes | |||
3600 | // but it will result in over-shoot or under-shoot of the target orientation. | 3595 | // but it will result in over-shoot or under-shoot of the target orientation. |
3601 | // For the end user, this means that ctrl+shift+drag can be used for relative, | 3596 | // For the end user, this means that ctrl+shift+drag can be used for relative, |
3602 | // but not absolute, adjustments of orientation for physical prims. | 3597 | // but not absolute, adjustments of orientation for physical prims. |
3598 | |||
3599 | if (BlockGrabOverride || m_rootPart.BlockGrab) | ||
3600 | return; | ||
3601 | |||
3603 | if (m_scene.EventManager.TriggerGroupSpin(UUID, newOrientation)) | 3602 | if (m_scene.EventManager.TriggerGroupSpin(UUID, newOrientation)) |
3604 | { | 3603 | { |
3605 | PhysicsActor pa = m_rootPart.PhysActor; | 3604 | PhysicsActor pa = m_rootPart.PhysActor; |
3606 | 3605 | ||
3607 | if (pa != null) | 3606 | if (pa != null && pa.IsPhysical) |
3608 | { | 3607 | { |
3609 | if (pa.IsPhysical) | 3608 | if (m_rootPart.IsWaitingForFirstSpinUpdatePacket) |
3610 | { | 3609 | { |
3611 | if (m_rootPart.IsWaitingForFirstSpinUpdatePacket) | 3610 | // first time initialization of "old" orientation for calculation of delta rotations |
3612 | { | 3611 | m_rootPart.SpinOldOrientation = newOrientation; |
3613 | // first time initialization of "old" orientation for calculation of delta rotations | 3612 | m_rootPart.IsWaitingForFirstSpinUpdatePacket = false; |
3614 | m_rootPart.SpinOldOrientation = newOrientation; | ||
3615 | m_rootPart.IsWaitingForFirstSpinUpdatePacket = false; | ||
3616 | } | ||
3617 | else | ||
3618 | { | ||
3619 | // save and update old orientation | ||
3620 | Quaternion old = m_rootPart.SpinOldOrientation; | ||
3621 | m_rootPart.SpinOldOrientation = newOrientation; | ||
3622 | //m_log.Error("[SCENE OBJECT GROUP]: Old orientation is " + old); | ||
3623 | //m_log.Error("[SCENE OBJECT GROUP]: Incoming new orientation is " + newOrientation); | ||
3624 | |||
3625 | // compute difference between previous old rotation and new incoming rotation | ||
3626 | Quaternion minimalRotationFromQ1ToQ2 = Quaternion.Inverse(old) * newOrientation; | ||
3627 | |||
3628 | float rotationAngle; | ||
3629 | Vector3 rotationAxis; | ||
3630 | minimalRotationFromQ1ToQ2.GetAxisAngle(out rotationAxis, out rotationAngle); | ||
3631 | rotationAxis.Normalize(); | ||
3632 | |||
3633 | //m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis); | ||
3634 | Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z); | ||
3635 | spinforce = (spinforce/8) * pa.Mass; // 8 is an arbitrary torque scaling factor | ||
3636 | pa.AddAngularForce(spinforce,true); | ||
3637 | m_scene.PhysicsScene.AddPhysicsActorTaint(pa); | ||
3638 | } | ||
3639 | } | 3613 | } |
3640 | else | 3614 | else |
3641 | { | 3615 | { |
3642 | NonPhysicalSpinMovement(newOrientation); | 3616 | // save and update old orientation |
3617 | Quaternion old = m_rootPart.SpinOldOrientation; | ||
3618 | m_rootPart.SpinOldOrientation = newOrientation; | ||
3619 | //m_log.Error("[SCENE OBJECT GROUP]: Old orientation is " + old); | ||
3620 | //m_log.Error("[SCENE OBJECT GROUP]: Incoming new orientation is " + newOrientation); | ||
3621 | |||
3622 | // compute difference between previous old rotation and new incoming rotation | ||
3623 | Quaternion minimalRotationFromQ1ToQ2 = newOrientation * Quaternion.Inverse(old); | ||
3624 | |||
3625 | float rotationAngle; | ||
3626 | Vector3 spinforce; | ||
3627 | minimalRotationFromQ1ToQ2.GetAxisAngle(out spinforce, out rotationAngle); | ||
3628 | if(Math.Abs(rotationAngle)< 0.001) | ||
3629 | return; | ||
3630 | |||
3631 | spinforce.Normalize(); | ||
3632 | |||
3633 | //m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis); | ||
3634 | if(rotationAngle > 0) | ||
3635 | spinforce = spinforce * pa.Mass * 0.1f; // 0.1 is an arbitrary torque scaling factor | ||
3636 | else | ||
3637 | spinforce = spinforce * pa.Mass * -0.1f; // 0.1 is an arbitrary torque scaling | ||
3638 | pa.AddAngularForce(spinforce,true); | ||
3639 | m_scene.PhysicsScene.AddPhysicsActorTaint(pa); | ||
3643 | } | 3640 | } |
3644 | } | 3641 | } |
3645 | else | 3642 | else |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index cb7422b..bb6e89b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3335,11 +3335,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3335 | Velocity = Vector3.Zero; | 3335 | Velocity = Vector3.Zero; |
3336 | m_AngularVelocity = Vector3.Zero; | 3336 | m_AngularVelocity = Vector3.Zero; |
3337 | 3337 | ||
3338 | m_requestedSitTargetID = 0; | ||
3339 | part.AddSittingAvatar(this); | ||
3340 | |||
3341 | ParentPart = part; | ||
3342 | ParentID = part.LocalId; | ||
3343 | |||
3338 | Vector3 cameraAtOffset = part.GetCameraAtOffset(); | 3344 | Vector3 cameraAtOffset = part.GetCameraAtOffset(); |
3339 | Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); | 3345 | Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); |
3340 | bool forceMouselook = part.GetForceMouselook(); | 3346 | bool forceMouselook = part.GetForceMouselook(); |
3341 | 3347 | ||
3342 | |||
3343 | if (!part.IsRoot) | 3348 | if (!part.IsRoot) |
3344 | { | 3349 | { |
3345 | Orientation = part.RotationOffset * Orientation; | 3350 | Orientation = part.RotationOffset * Orientation; |
@@ -3365,13 +3370,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3365 | 3370 | ||
3366 | ControllingClient.SendSitResponse( | 3371 | ControllingClient.SendSitResponse( |
3367 | part.ParentGroup.UUID, offset, Orientation, true, cameraAtOffset, cameraEyeOffset, forceMouselook); | 3372 | part.ParentGroup.UUID, offset, Orientation, true, cameraAtOffset, cameraEyeOffset, forceMouselook); |
3368 | |||
3369 | 3373 | ||
3370 | m_requestedSitTargetID = 0; | ||
3371 | part.AddSittingAvatar(this); | ||
3372 | |||
3373 | ParentPart = part; | ||
3374 | ParentID = part.LocalId; | ||
3375 | 3374 | ||
3376 | SendAvatarDataToAllAgents(); | 3375 | SendAvatarDataToAllAgents(); |
3377 | 3376 | ||
@@ -5560,6 +5559,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
5560 | 5559 | ||
5561 | public void HandleForceReleaseControls(IClientAPI remoteClient, UUID agentID) | 5560 | public void HandleForceReleaseControls(IClientAPI remoteClient, UUID agentID) |
5562 | { | 5561 | { |
5562 | foreach (ScriptControllers c in scriptedcontrols.Values) | ||
5563 | { | ||
5564 | SceneObjectGroup sog = m_scene.GetSceneObjectGroup(c.objectID); | ||
5565 | if(sog != null && !sog.IsDeleted && sog.RootPart.PhysActor != null) | ||
5566 | sog.RootPart.PhysActor.OnPhysicsRequestingCameraData -= physActor_OnPhysicsRequestingCameraData; | ||
5567 | } | ||
5568 | |||
5563 | IgnoredControls = ScriptControlled.CONTROL_ZERO; | 5569 | IgnoredControls = ScriptControlled.CONTROL_ZERO; |
5564 | lock (scriptedcontrols) | 5570 | lock (scriptedcontrols) |
5565 | { | 5571 | { |
@@ -5568,6 +5574,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
5568 | ControllingClient.SendTakeControls(int.MaxValue, false, false); | 5574 | ControllingClient.SendTakeControls(int.MaxValue, false, false); |
5569 | } | 5575 | } |
5570 | 5576 | ||
5577 | public void HandleRevokePermissions(UUID objectID, uint permissions ) | ||
5578 | { | ||
5579 | |||
5580 | // still skeleton code | ||
5581 | if((permissions & (16 | 0x8000 )) == 0) //PERMISSION_TRIGGER_ANIMATION | PERMISSION_OVERRIDE_ANIMATIONS | ||
5582 | return; | ||
5583 | if(objectID == m_scene.RegionInfo.RegionID) // for all objects | ||
5584 | { | ||
5585 | |||
5586 | } | ||
5587 | else | ||
5588 | { | ||
5589 | SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); | ||
5590 | if(part != null) | ||
5591 | { | ||
5592 | |||
5593 | } | ||
5594 | } | ||
5595 | } | ||
5596 | |||
5571 | public void ClearControls() | 5597 | public void ClearControls() |
5572 | { | 5598 | { |
5573 | IgnoredControls = ScriptControlled.CONTROL_ZERO; | 5599 | IgnoredControls = ScriptControlled.CONTROL_ZERO; |