public void UpdateFaceFromCenter() { Vector3 difference = center.coordinates - centerPosition; centerPosition = center.coordinates; // go through each vertex and apply a similar translation for (int i = 0; i < vertexBundles.Length; i++) { if (vertexBundles[i] != center) { vertexBundles[i].coordinates += difference; } } scaleHandle.transform.localPosition += difference; centerHandle.transform.localPosition = centerPosition; if (heightHandle != null) { heightHandle.transform.localPosition = centerPosition; } scalerPosition = scaler.coordinates; parentModelingObject.CalculateBoundingBox(); parentModelingObject.PositionHandles(false); parentModelingObject.RotateHandles(); }
public void ShowRotationHandles() { //DisableHandles(); connectedModelingObject.PositionHandles(true); connectedModelingObject.RotateHandles(); connectedModelingObject.HideBoundingBox(false); connectingLines.SetActive(true); RotateAndTranslate.gameObject.SetActive(true); if (!ProModeMananager.Instance.beginnersMode) { WorldLocalToggle.Instance.Show(YMovement.transform.GetChild(0)); } TouchElements.Instance.PositionRotationButtons(connectedModelingObject); if (!TouchElements.Instance.rotationToggleUIElement.active) { TouchElements.Instance.SetRotationToggleActive(); } TouchElements.Instance.ShowRotationButtons(true); }
public void ReachGoal() { ModelingObject currentObj = selection.currentSelection.GetComponent <ModelingObject> (); currentObj.PositionHandles(true); currentObj.RotateHandles(); currentObj.handles.ShowNonUniformScalingHandles(); if (currentObj.handles.rotationHandlesvisible) { currentObj.handles.ShowRotationHandles(); } currentObj.DrawConnectingLines(); moving = false; }
public bool ApplyChanges(GameObject pointOfCollision, bool alreadyMoving, Selection controller) { if (!alreadyMoving) { //connectedModelingObject.HideBoundingBox (false); } switch (typeOfHandle) { case handleType.ScaleFace: ScaleFace(pointOfCollision); break; case handleType.PositionCenter: MoveCenterPosition(pointOfCollision); break; case handleType.Height: ChangeHeight(pointOfCollision); break; case handleType.Rotation: if (!alreadyMoving) { handles.HideRotationHandlesExcept(null); connectedModelingObject.CalculateBoundingBox(); connectedModelingObject.CalculateBoundingBoxWorld(); handles.HideScalingHandlesExcept(null); TouchElements.Instance.Hide(); newRotation = true; } Rotate(pointOfCollision, controller, true); connectedModelingObject.PositionHandles(true); connectedModelingObject.RotateHandles(); handles.HideRotationHandlesExcept(null); handles.HideScalingHandlesExcept(this); break; case handleType.ScaleX: if (!alreadyMoving) { handles.HideRotationHandlesExcept(null); handles.HideScalingHandlesExcept(this); newScaling = true; } ScaleNonUniform(pointOfCollision, new Vector3(1f, 0f, 0f)); break; case handleType.ScaleY: if (!alreadyMoving) { handles.HideRotationHandlesExcept(null); handles.HideScalingHandlesExcept(this); newScaling = true; } ScaleNonUniform(pointOfCollision, new Vector3(0f, 1f, 0f)); break; case handleType.ScaleZ: if (!alreadyMoving) { handles.HideRotationHandlesExcept(null); handles.HideScalingHandlesExcept(this); newScaling = true; } ScaleNonUniform(pointOfCollision, new Vector3(0f, 0f, 1f)); break; case handleType.ScaleMinusX: if (!alreadyMoving) { handles.HideRotationHandlesExcept(null); handles.HideScalingHandlesExcept(this); newScaling = true; } ScaleNonUniform(pointOfCollision, new Vector3(1f, 0f, 0f)); break; case handleType.ScaleMinusY: if (!alreadyMoving) { handles.HideRotationHandlesExcept(null); handles.HideScalingHandlesExcept(this); newScaling = true; } ScaleNonUniform(pointOfCollision, new Vector3(0f, 1f, 0f)); break; case handleType.ScaleMinusZ: if (!alreadyMoving) { handles.HideRotationHandlesExcept(null); handles.HideScalingHandlesExcept(this); newScaling = true; } ScaleNonUniform(pointOfCollision, new Vector3(0f, 0f, 1f)); break; case handleType.MoveY: if (!alreadyMoving) { handles.HideRotationHandlesExcept(null); handles.HideScalingHandlesExcept(this); newMovement = true; } MoveYPosition(pointOfCollision); handles.HideRotationHandlesExcept(null); handles.HideScalingHandlesExcept(this); break; case handleType.UniformScale: Debug.Log("already moving " + alreadyMoving); if (!alreadyMoving) { handles.HideRotationHandlesExcept(null); handles.HideScalingHandlesExcept(this); newScaling = true; } ScaleUniform(pointOfCollision); handles.HideRotationHandlesExcept(null); handles.HideScalingHandlesExcept(this); break; case handleType.RotationHandleToggle: //handles.ToggleOnOffRotationHandles (); break; } connectedModelingObject.RecalculateSideCenters(); connectedModelingObject.RecalculateNormals(); //handles.HideRotationHandlesExcept (null); //handles.HideScalingHandlesExcept (this); //connectedModelingObject.ShowBoundingBox (); //connectedModelingObject.ShowBoundingBox (); return(true); }