diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 48fce3d..329ea11 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -110,6 +110,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
110 | STATUS_ROTATE_X = 0x002, | 110 | STATUS_ROTATE_X = 0x002, |
111 | STATUS_ROTATE_Y = 0x004, | 111 | STATUS_ROTATE_Y = 0x004, |
112 | STATUS_ROTATE_Z = 0x008, | 112 | STATUS_ROTATE_Z = 0x008, |
113 | NOT_STATUS_ROTATE_X = 0xFD, | ||
114 | NOT_STATUS_ROTATE_Y = 0xFB, | ||
115 | NOT_STATUS_ROTATE_Z = 0xF7 | ||
113 | } | 116 | } |
114 | 117 | ||
115 | // This flag has the same purpose as InventoryItemFlags.ObjectSlamPerm | 118 | // This flag has the same purpose as InventoryItemFlags.ObjectSlamPerm |
@@ -4367,30 +4370,52 @@ namespace OpenSim.Region.Framework.Scenes | |||
4367 | bool setY = ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) != 0); | 4370 | bool setY = ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) != 0); |
4368 | bool setZ = ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) != 0); | 4371 | bool setZ = ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) != 0); |
4369 | 4372 | ||
4370 | float setval = (rotate10 > 0) ? 1f : 0f; | 4373 | if (setX || setY || setZ) |
4374 | { | ||
4375 | bool lockaxis = (rotate10 == 0); // zero means axis locked | ||
4376 | |||
4377 | byte locks = RootPart.RotationAxisLocks; | ||
4371 | 4378 | ||
4372 | if (setX) | 4379 | if (setX) |
4373 | RootPart.RotationAxis.X = setval; | 4380 | { |
4374 | if (setY) | 4381 | if(lockaxis) |
4375 | RootPart.RotationAxis.Y = setval; | 4382 | locks |= (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_X; |
4376 | if (setZ) | 4383 | else |
4377 | RootPart.RotationAxis.Z = setval; | 4384 | locks &= (byte)SceneObjectGroup.axisSelect.NOT_STATUS_ROTATE_X; |
4385 | } | ||
4386 | |||
4387 | if (setY) | ||
4388 | { | ||
4389 | if(lockaxis) | ||
4390 | locks |= (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y; | ||
4391 | else | ||
4392 | locks &= (byte)SceneObjectGroup.axisSelect.NOT_STATUS_ROTATE_Y; | ||
4393 | } | ||
4378 | 4394 | ||
4379 | if (setX || setY || setZ) | 4395 | if (setZ) |
4396 | { | ||
4397 | if(lockaxis) | ||
4398 | locks |= (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z; | ||
4399 | else | ||
4400 | locks &= (byte)SceneObjectGroup.axisSelect.NOT_STATUS_ROTATE_Z; | ||
4401 | } | ||
4402 | |||
4403 | RootPart.RotationAxisLocks = locks; | ||
4380 | RootPart.SetPhysicsAxisRotation(); | 4404 | RootPart.SetPhysicsAxisRotation(); |
4405 | } | ||
4381 | } | 4406 | } |
4382 | 4407 | ||
4383 | public int GetAxisRotation(int axis) | 4408 | public int GetAxisRotation(int axis) |
4384 | { | 4409 | { |
4385 | Vector3 rotAxis = RootPart.RotationAxis; | 4410 | byte rotAxislocks = RootPart.RotationAxisLocks; |
4386 | 4411 | ||
4387 | // if multiple return the one with higher id | 4412 | // if multiple return the one with higher id |
4388 | if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) | 4413 | if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) |
4389 | return (int)rotAxis.Z; | 4414 | return (rotAxislocks & (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) == 0 ? 1:0; |
4390 | if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) | 4415 | if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) |
4391 | return (int)rotAxis.Y; | 4416 | return (rotAxislocks & (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) == 0 ? 1:0; |
4392 | if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) | 4417 | if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) |
4393 | return (int)rotAxis.X; | 4418 | return (rotAxislocks & (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) == 0 ? 1:0; |
4394 | 4419 | ||
4395 | return 0; | 4420 | return 0; |
4396 | } | 4421 | } |