diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 1dd3d2f..b45cc4d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -2492,6 +2492,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2492 | } | 2492 | } |
2493 | 2493 | ||
2494 | SceneObjectGroup sog; | 2494 | SceneObjectGroup sog; |
2495 | |||
2496 | bool fixrot = false; | ||
2497 | Quaternion netRot = Quaternion.Identity; | ||
2498 | |||
2495 | // position adjust | 2499 | // position adjust |
2496 | if (totalPrims > 1) // nothing to do on a single prim | 2500 | if (totalPrims > 1) // nothing to do on a single prim |
2497 | { | 2501 | { |
@@ -2506,17 +2510,50 @@ namespace OpenSim.Region.Framework.Scenes | |||
2506 | orot = sog.RootPart.GetWorldRotation(); | 2510 | orot = sog.RootPart.GetWorldRotation(); |
2507 | else | 2511 | else |
2508 | orot = rot.Value; | 2512 | orot = rot.Value; |
2513 | // possible should be bbox, but geometric center looks better | ||
2509 | Vector3 off = sog.GetGeometricCenter(); | 2514 | Vector3 off = sog.GetGeometricCenter(); |
2515 | // Vector3 off = bbox * 0.5f; | ||
2510 | off *= orot; | 2516 | off *= orot; |
2511 | pos -= off; | 2517 | pos -= off; |
2512 | } | 2518 | } |
2513 | } | 2519 | } |
2520 | else | ||
2521 | { | ||
2522 | //veclist[] are relative to bbox corner with min X,Y and Z | ||
2523 | // rez at root, and rot will be referenced to first object in list | ||
2524 | if (rot == null) | ||
2525 | { | ||
2526 | // use original rotations | ||
2527 | if (atRoot) | ||
2528 | pos -= veclist[0]; | ||
2529 | else | ||
2530 | pos -= bbox / 2; | ||
2531 | } | ||
2532 | else | ||
2533 | { | ||
2534 | fixrot = true; | ||
2535 | sog = objlist[0]; | ||
2536 | netRot = Quaternion.Conjugate(sog.RootPart.GetWorldRotation()); | ||
2537 | netRot = netRot * rot.Value; | ||
2538 | Vector3 off; | ||
2539 | if (atRoot) | ||
2540 | off = veclist[0]; | ||
2541 | else | ||
2542 | off = bbox / 2; | ||
2543 | off *= netRot; | ||
2544 | pos -= off; | ||
2545 | } | ||
2546 | } | ||
2514 | } | 2547 | } |
2515 | 2548 | ||
2516 | for (int i = 0; i < objlist.Count; i++) | 2549 | for (int i = 0; i < objlist.Count; i++) |
2517 | { | 2550 | { |
2518 | SceneObjectGroup group = objlist[i]; | 2551 | SceneObjectGroup group = objlist[i]; |
2519 | Vector3 curpos = pos + veclist[i]; | 2552 | Vector3 curpos; |
2553 | if(fixrot) | ||
2554 | curpos = pos + veclist[i] * netRot; | ||
2555 | else | ||
2556 | curpos = pos + veclist[i]; | ||
2520 | 2557 | ||
2521 | if (group.IsAttachment == false && group.RootPart.Shape.State != 0) | 2558 | if (group.IsAttachment == false && group.RootPart.Shape.State != 0) |
2522 | { | 2559 | { |
@@ -2525,7 +2562,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2525 | } | 2562 | } |
2526 | 2563 | ||
2527 | group.FromPartID = sourcePart.UUID; | 2564 | group.FromPartID = sourcePart.UUID; |
2528 | AddNewSceneObject(group, true, curpos, rot, vel); | 2565 | if( i == 0) |
2566 | AddNewSceneObject(group, true, curpos, rot, vel); | ||
2567 | else | ||
2568 | { | ||
2569 | Quaternion crot = objlist[i].RootPart.GetWorldRotation(); | ||
2570 | if (fixrot) | ||
2571 | { | ||
2572 | crot *= netRot; | ||
2573 | } | ||
2574 | AddNewSceneObject(group, true, curpos, crot, vel); | ||
2575 | } | ||
2529 | 2576 | ||
2530 | // We can only call this after adding the scene object, since the scene object references the scene | 2577 | // We can only call this after adding the scene object, since the scene object references the scene |
2531 | // to find out if scripts should be activated at all. | 2578 | // to find out if scripts should be activated at all. |