aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
authorUbitUmarov2016-09-16 19:23:56 +0100
committerUbitUmarov2016-09-16 19:23:56 +0100
commitfb46eb3344f50aecf2796e3940a66ee6e3d57915 (patch)
tree2b19409bf423191a401289750944cb8c2a25f787 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
parentMinor. Remove unused integer arrays from TerrainModule (diff)
downloadopensim-SC-fb46eb3344f50aecf2796e3940a66ee6e3d57915.zip
opensim-SC-fb46eb3344f50aecf2796e3940a66ee6e3d57915.tar.gz
opensim-SC-fb46eb3344f50aecf2796e3940a66ee6e3d57915.tar.bz2
opensim-SC-fb46eb3344f50aecf2796e3940a66ee6e3d57915.tar.xz
pass touch_end as other touchs, make blockgrab work on nonphysical also
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs96
1 files changed, 44 insertions, 52 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index b7c5b6b..00951d6 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,43 @@ 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 = Quaternion.Inverse(old) * newOrientation;
3624
3625 float rotationAngle;
3626 Vector3 rotationAxis;
3627 minimalRotationFromQ1ToQ2.GetAxisAngle(out rotationAxis, out rotationAngle);
3628 rotationAxis.Normalize();
3629
3630 //m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis);
3631 Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z);
3632 spinforce = (spinforce/8) * pa.Mass; // 8 is an arbitrary torque scaling factor
3633 pa.AddAngularForce(spinforce,true);
3634 m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
3643 } 3635 }
3644 } 3636 }
3645 else 3637 else