public void XAxis() { axis = RotationAxis.XAxis; NativeArray <Vector3> targetPositions = new NativeArray <Vector3>(targets, Allocator.Temp); NativeArray <float> Weights = new NativeArray <float>(_weights, Allocator.Temp); DotToVecJob job = new DotToVecJob() { targets = targetPositions, scaled = scaled, my_position = position, range = range, weight = weight, angle = angle, invertScale = invertScale, axis = axis, Weights = Weights, direction = direction }; // compute job.Execute(); // check result float[] expected = { 1f, 0f, -1f, 0f }; Assert.AreEqual(expected[0], Weights[0], TestUtilities.DOTPRODTOLERANCE); Assert.AreEqual(expected[1], Weights[1], TestUtilities.DOTPRODTOLERANCE); Assert.AreEqual(expected[2], Weights[2], TestUtilities.DOTPRODTOLERANCE); Assert.AreEqual(expected[3], Weights[3], TestUtilities.DOTPRODTOLERANCE); targetPositions.Dispose(); Weights.Dispose(); }
// Rotates this object around the desired axis in a counter clockwise direction // (viewed from the + end of the axis) private void _Rotate(RotationAxis axis) { TranformationFunc f; Discrete3DCoord new_dims; switch (axis) { case RotationAxis.X_AXIS: new_dims = new Discrete3DCoord(this.dims.x, this.dims.z, this.dims.y); f = coord => new Discrete3DCoord(coord.x, coord.z, this.dims.y - coord.y - 1); break; case RotationAxis.Y_AXIS: new_dims = new Discrete3DCoord(this.dims.z, this.dims.y, this.dims.x); f = coord => new Discrete3DCoord(this.dims.z - coord.z - 1, coord.y, coord.x); break; case RotationAxis.Z_AXIS: new_dims = new Discrete3DCoord(this.dims.y, this.dims.x, this.dims.z); f = coord => new Discrete3DCoord(this.dims.y - coord.y - 1, coord.x, coord.z); break; default: throw new System.Exception(string.Format("Attempted to rotate along axis {0} which is not accounted for", axis)); } _ApplyTransformation(f, new_dims); }
// Computes the per-axis contribution of q. // Based on: https://stackoverflow.com/questions/43606135/split-quaternion-into-axis-rotations public static Quaternion ComponentQuaternion(Quaternion q, RotationAxis axis) { float theta; Quaternion axisRot; switch (axis) { case RotationAxis.X: theta = Mathf.Atan2(q.x, q.w); axisRot = new Quaternion(Mathf.Sin(theta), 0, 0, Mathf.Cos(theta)); break; case RotationAxis.Y: theta = Mathf.Atan2(q.y, q.w); axisRot = new Quaternion(0, Mathf.Sin(theta), 0, Mathf.Cos(theta)); break; // case RotationAxis.Z: default: theta = Mathf.Atan2(q.z, q.w); axisRot = new Quaternion(0, 0, Mathf.Sin(theta), Mathf.Cos(theta)); break; } return(axisRot); }
} // SetLookAt(setCamPos, setLookPos, setUpVector) #endregion #region Rotate methods /// <summary> /// Rotate around pitch, roll or yaw axis. /// </summary> /// <param name="axis">Axis</param> /// <param name="angle">Angle</param> private void Rotate(RotationAxis axis, float angle) { if (axis == RotationAxis.Yaw) { yawRotation -= angle; } else { pitchRotation -= angle; } /*left handed! * if (axis == RotationAxis.Yaw) * yawRotation += angle; * else * pitchRotation += angle; * * /*old from RC: * Rotate( * axis == RotationAxis.Pitch ? new Vector3(1.0f, 0.0f, 0.0f) : * // Our world is xz based for some reason ^^ this way it works * axis == RotationAxis.Roll ? new Vector3(0.0f, 0.0f, 1.0f) : * new Vector3(0.0f, 1.0f, 0.0f), angle); */ } // Rotate(axis, angle)
/// <summary> /// Initalisiert die Rotation und legt die Rotations Achse und Richtung fest /// </summary> private void InitRotation(RotationAxis axis, RotationDirection dir) { switch (axis) { case RotationAxis.forward: rotationAxis = this.transform.forward; break; case RotationAxis.right: rotationAxis = this.transform.right; break; case RotationAxis.up: rotationAxis = this.transform.up; break; } switch (dir) { case RotationDirection.clockwise: rotatioDirection = -1; break; case RotationDirection.counterClockwise: rotatioDirection = 1; break; } }
public void RotateToAxis(RotationAxis rotAxis) { if (IsRotating) { return; } if (AxisSelectorManager.instance) { if (AxisSelectorManager.instance.playerOnCube) { return; } } //StartCoroutine(Rotate_Courutine(rotAxis)); IsRotating = true; ReparentAll(); ParentRubikCubes_ToRotation(rotAxis); RotationAuxiliar.transform.DOLocalRotate( AngleToRotate(rotAxis), 1, RotateMode.LocalAxisAdd ).OnComplete(() => { IsRotating = false; ReparentAll(); UpdateMatrix(); }); //ShowCubesInfo(); }
public void OpenDoor(RotationAxis axis) { if (!isOpen) { switch (axis) { case RotationAxis.X: { //LERP THE X-ROTATION OF 'Door' TO THE VALUE 'MaxDoorRotation' var currentRot = Door.rotation; var x_rot = currentRot[0]; x_rot = Mathf.LerpAngle(x_rot, MaxDoorRotation, Time.smoothDeltaTime * DoorRotationSpeed); break; } case RotationAxis.Y: { break; } case RotationAxis.Z: { break; } default: { break; } } } }
// Angulo que debería rotar en funcion de cada eje Vector3 AngleToRotate(RotationAxis rotAxis) { if (rotAxis == RotationAxis.X_1_POS || rotAxis == RotationAxis.X_2_POS || rotAxis == RotationAxis.X_3_POS) { return(new Vector3(-90, 0, 0)); } if (rotAxis == RotationAxis.X_1_NEG || rotAxis == RotationAxis.X_2_NEG || rotAxis == RotationAxis.X_3_NEG) { return(new Vector3(90, 0, 0)); } if (rotAxis == RotationAxis.Z_1_POS || rotAxis == RotationAxis.Z_2_POS || rotAxis == RotationAxis.Z_3_POS) { return(new Vector3(0, 0, -90)); } if (rotAxis == RotationAxis.Z_1_NEG || rotAxis == RotationAxis.Z_2_NEG || rotAxis == RotationAxis.Z_3_NEG) { return(new Vector3(0, 0, 90)); } return(Vector3.zero); }
private void RotateView(MCView view, RotationAxis rotationAxis, int number, double angle, string viewNameTemplate, bool useExistingWorkOffset) { var instance = 1; var initialAngle = angle; while (number >= instance) { var rotatedView = new MCView { ViewName = BuildViewNameFromTemplate(view.ViewName, view.ViewOrigin.ToString(), rotationAxis.LinearLabel, rotationAxis.RotaryLabel, instance.ToString(), angle.ToString(), viewNameTemplate), ViewOrigin = view.ViewOrigin, ViewMatrix = CreateMatrix(view.ViewMatrix, rotationAxis.Axis, angle) }; if (useExistingWorkOffset) { rotatedView.WorkOffsetNumber = view.WorkOffsetNumber; } rotatedView.Commit(); instance++; angle = initialAngle * instance; } }
// cubo que sería el centro de la rotacion en funcion de cada eje RubikCube CenterOfRotation(RotationAxis rotAxis) { switch (rotAxis) { case RotationAxis.X_1_POS: return(cubes[0, 1, 1]); case RotationAxis.X_1_NEG: return(cubes[0, 1, 1]); case RotationAxis.X_2_POS: return(cubes[1, 1, 1]); case RotationAxis.X_2_NEG: return(cubes[1, 1, 1]); case RotationAxis.X_3_POS: return(cubes[2, 1, 1]); case RotationAxis.X_3_NEG: return(cubes[2, 1, 1]); case RotationAxis.Z_1_POS: return(cubes[1, 1, 0]); case RotationAxis.Z_1_NEG: return(cubes[1, 1, 0]); case RotationAxis.Z_2_POS: return(cubes[1, 1, 1]); case RotationAxis.Z_2_NEG: return(cubes[1, 1, 1]); case RotationAxis.Z_3_POS: return(cubes[1, 1, 2]); case RotationAxis.Z_3_NEG: return(cubes[1, 1, 2]); default: return(cubes[0, 0, 0]); } }
public override void Reset() { gameObject = null; everyFrame = true; axis = RotationAxis.Pitch; axisMultiplier = new FsmFloat { UseVariable = true }; }
/// <summary> /// Создает сетевой источник данных /// </summary> /// <param name="_axis">выбранная ось вращения</param> /// <param name="_ipAddress">IP-адрес сервера</param> public SourceNetwork(RotationAxis _axis, IPAddress _ipAddress) : base() { IsWorking = false; axis = _axis; thread.Name = "SourceNetwork"; ipAddress = _ipAddress; deserializer = new DeserializerCustom(); mutex = new object(); }
// Start is called before the first frame update void Start() { if (rotationAxisClass == null) { rotationAxisClass = GameObject.FindObjectOfType <RotationAxis>(); } rb = GetComponent <Rigidbody>(); }
Mesh RotateMesh(Mesh M, RotationAxis Axis, float DOR) { Vector3[] vertices = M.vertices; Vector3[] normals = M.normals; switch (Axis) { case RotationAxis.x: { for (int i = 0; i < vertices.Length; i++) { float VerY = (Mathf.Cos(DOR) * vertices [i].y) - (Mathf.Sin(DOR) * vertices [i].z); float VerZ = (Mathf.Sin(DOR) * vertices [i].y) + (Mathf.Cos(DOR) * vertices [i].z); vertices [i] = new Vector3(vertices [i].x, VerY, VerZ); float NorY = (Mathf.Cos(DOR) * normals [i].y) - (Mathf.Sin(DOR) * normals [i].z); float NorZ = (Mathf.Sin(DOR) * normals [i].y) + (Mathf.Cos(DOR) * normals [i].z); normals [i] = new Vector3(normals [i].x, NorY, NorZ); } break; } case RotationAxis.y: { for (int i = 0; i < vertices.Length; i++) { float VerX = (Mathf.Cos(DOR) * vertices [i].x) - (Mathf.Sin(DOR) * vertices [i].z); float VerZ = (Mathf.Sin(DOR) * vertices [i].x) + (Mathf.Cos(DOR) * vertices [i].z); vertices [i] = new Vector3(VerX, vertices [i].y, VerZ); float NorX = (Mathf.Cos(DOR) * normals [i].x) - (Mathf.Sin(DOR) * normals [i].z); float NorZ = (Mathf.Sin(DOR) * normals [i].x) + (Mathf.Cos(DOR) * normals [i].z); normals [i] = new Vector3(NorX, normals [i].y, NorZ); } break; } case RotationAxis.z: { for (int i = 0; i < vertices.Length; i++) { float VerX = (Mathf.Cos(DOR) * vertices [i].x) - (Mathf.Sin(DOR) * vertices [i].y); float VerY = (Mathf.Sin(DOR) * vertices [i].x) + (Mathf.Cos(DOR) * vertices [i].y); vertices [i] = new Vector3(VerX, VerY, vertices [i].z); float NorX = (Mathf.Cos(DOR) * normals [i].x) - (Mathf.Sin(DOR) * normals [i].y); float NorY = (Mathf.Sin(DOR) * normals [i].x) + (Mathf.Cos(DOR) * normals [i].y); normals [i] = new Vector3(NorX, NorY, normals [i].z); } break; } } M.vertices = vertices; M.normals = normals; M.RecalculateBounds(); return(M); }
private void Start() { if (GetComponent <Rigidbody>()) { GetComponent <Rigidbody>().freezeRotation = false; } if (GetComponent <Camera>()) { axis = RotationAxis.MouseV; } }
private void Start() { //Freeze the rigidbody so it doesnt fall over if (GetComponent <Rigidbody>()) { GetComponent <Rigidbody>().freezeRotation = true; } if (GetComponent <Camera>()) { axis = RotationAxis.MouseV; } }
private static float getRotationOnAxis(Vector3 rot, RotationAxis axis) { switch (axis) { case RotationAxis.X: return(rot.x); case RotationAxis.Y: return(rot.y); case RotationAxis.Z: return(rot.z); default: return(float.NaN); } }
public Blueprint Rotate(RotationAxis axis, int rotation_magnitude) { int[] my_dims = this.GetDimsArr(); Blueprint rotated = new Blueprint(my_dims[0], my_dims[1], my_dims[2]); this.CopyInto(rotated); for (int i = 0; i < pos_mod(rotation_magnitude, 4); i++) { rotated._Rotate(axis); } return(rotated); }
private static float getRotationOnAxis(Quaternion rot, RotationAxis axis) { switch (axis) { case RotationAxis.X: return(rot.eulerAngles.x); case RotationAxis.Y: return(rot.eulerAngles.y); case RotationAxis.Z: return(rot.eulerAngles.z); default: return(float.NaN); } }
public SixenseControllerData(sixenseControllerRawData data) { _position = data.Position; _rotationAxis = new RotationAxis(data.RotationX, data.RotationY, data.RotationZ); _joystick = new Joystick(data.JoystickX, data.JoystickY); _trigger = data.Trigger; _buttons = new Buttons(data.Buttons); _rotationQuaternion = data.RotationQuaternion; _isEnabled = data.Enabled == 1 ? true : false; _controllerIndex = data.ControllerIndex; _isDocked = data.IsDocked == 1 ? true : false; _hand = data.WhichHand == 0 ? SixenseControllerHand.LeftHand : SixenseControllerHand.RightHand; }
private bool RotatePiece(RotationAxis axis) { if (!canRotate) { return(false); } // We want to see that after the full rotation the piece does not // overlap any previously layed down piece. But we also want to check // that the transition to the rotation is also possible, that the path // followed by the rotation movement is not obstructed. So we first rotate // by 45 degrees, check if the position of each cube after that rotation // does not overlap any previously layed down pieces, and if not then // rotate by another 45 degrees and do the same checks. float xAngle = 0; float yAngle = 0; switch (axis) { case RotationAxis.X: xAngle = 45; break; case RotationAxis.Y: yAngle = 45; break; } transform.Rotate(xAngle, yAngle, 0, Space.World); if (InvalidPosition()) { transform.Rotate(-xAngle, -yAngle, 0, Space.World); AudioSource.PlayClipAtPoint(canNotMoveSFX, transform.position); return(false); } transform.Rotate(xAngle, yAngle, 0, Space.World); if (InvalidPosition()) { transform.Rotate(-xAngle * 2, -yAngle * 2, 0, Space.World); AudioSource.PlayClipAtPoint(canNotMoveSFX, transform.position); return(false); } AudioSource.PlayClipAtPoint(moveSFX, transform.position); return(true); }
private void Rotate(double angle, RotationAxis axis) { float[][] array = new float[4][] { new float[4], new float[4], new float[4], new float[4] }; angle = -1.0 * angle; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { if (i == j) { array[i][j] = 1f; } else { array[i][j] = 0f; } } } switch (axis) { case RotationAxis.X: array[1][1] = (float)Math.Cos(angle); array[1][2] = (float)(0.0 - Math.Sin(angle)); array[2][1] = (float)Math.Sin(angle); array[2][2] = (float)Math.Cos(angle); break; case RotationAxis.Y: array[0][0] = (float)Math.Cos(angle); array[0][2] = (float)Math.Sin(angle); array[2][0] = (float)(0.0 - Math.Sin(angle)); array[2][2] = (float)Math.Cos(angle); break; case RotationAxis.Z: array[0][0] = (float)Math.Cos(angle); array[0][1] = (float)(0.0 - Math.Sin(angle)); array[1][0] = (float)Math.Sin(angle); array[1][1] = (float)Math.Cos(angle); break; } Multiply(array, MatrixOrder.Prepend, setMainMatrix: true); }
private static Quaternion fromRotationAxis(float n, RotationAxis axis = RotationAxis.Z) { if (axis == RotationAxis.X) { return(Quaternion.Euler(n, 0, 0)); } else if (axis == RotationAxis.Y) { return(Quaternion.Euler(0, n, 0)); } else { return(Quaternion.Euler(0, 0, n)); } }
/// <summary> /// Gets an axis of a transform, useful for serialising rotation directions /// </summary> /// <param name="a_axis">The axis we want</param> /// <param name="a_transform">The transform to get the axis from</param> /// <returns>The axis of the transform</returns> public static Vector3 AxisToVector3(RotationAxis a_axis, Transform a_transform) { if (a_axis == RotationAxis.Up) { return(a_transform.up); } else if (a_axis == RotationAxis.Right) { return(a_transform.right); } else { return(a_transform.forward); } }
public override IEnumerator ReceivePayload(VisualPayload payload) { RotateOverTimeSatellite.CreateRotateOverTimeSatellite( payload.VisualData.Bound.gameObject, RotationAxis.GetFirstValue(payload.Data), RotationSpeed.GetFirstValue(payload.Data), AbsoluteRotation.GetFirstValue(payload.Data)); var iterator = Router.TransmitAll(payload); while (iterator.MoveNext()) { yield return(null); } }
private void _UnstableMutate() { System.Random rng = new System.Random(); // 0) Decide if we are adding or deleting. if (valid_ids.Count() == 0 || rng.NextDouble() > DELETE_CHANCE) { bool placed_block = false; int tries = 0; while (tries < MAX_PLACEMENT_ATTEMPTS && !placed_block) { // ------------- ADDING ------------- // 1) Pick a design from the notebook randomly int i = rng.Next(design_notebook.Count); // Debug.Log(string.Format("Using design {0}", i)); Blueprint random_design = design_notebook[i]; // 2) Randomly rotate the object System.Array enum_values = System.Enum.GetValues(typeof(RotationAxis)); RotationAxis axis = (RotationAxis)enum_values.GetValue(rng.Next(enum_values.Length)); int mag = rng.Next(3); Blueprint rotated = random_design.Rotate(axis, mag); // 3) Try to find a place for it Discrete3DCoord placement = FindValidOffsetFor(rotated); if (placement != null) { this.ApplyDesign(rotated, placement.x, placement.y, placement.z); placed_block = true; } // 4) Upon failure try again, limited to n tries tries++; } if (tries == MAX_PLACEMENT_ATTEMPTS && !placed_block) { // TODO: Figure out how to handle this error nicely Debug.Log("Could not find a valid mutation"); } } else { // ------------- DELETING------------- // TODO: Keep track of a set of valid ids // 1) Pick a valid id int[] valid_arr = valid_ids.ToArray(); int random_id = valid_arr[rng.Next(valid_arr.Count())]; // 2) Zero out all blocks with the same id // 3) Invalidate the id this.DeleteID(random_id); } }
public static Quaternion RotateAroundAxis(RotationAxis ContextMapAxis, float resolutionAngle) { switch (ContextMapAxis) { case RotationAxis.XAxis: return(Quaternion.Euler(resolutionAngle, 0f, 0f)); case RotationAxis.YAxis: return(Quaternion.Euler(0f, resolutionAngle, 0f)); case RotationAxis.ZAxis: return(Quaternion.Euler(0f, 0f, resolutionAngle)); } throw new System.NotImplementedException("Rotation Axis undefined."); }
public void SetSpline(BezierSpline spline, SimpleSplineParameters parameters) { AlignToNewSpline(spline); m_speedType = parameters.m_speedType; m_walkSpeed = parameters.m_walkSpeed; m_rotationType = parameters.m_rotationType; m_rotationAxis = parameters.m_rotationAxis; m_lookTarget = parameters.m_lookTarget; m_angleOffset = parameters.m_offsetAngle; m_autoWalk = parameters.m_autoWalk; m_autoReset = parameters.m_autoReset; m_destroyAtEnd = parameters.m_destroyAtEnd; ResetSpline(); }
public void Setup() { targets = new Vector3[] { new Vector3(0, 0, 10) }; scaled = false; position = new Vector3(0, 0, 0); range = 11; weight = 1; angle = 90; invertScale = 0; axis = RotationAxis.YAxis; _weights = new float[] { 0f, 0f, 0f, 0f }; direction = SteerDirection.ATTRACT; }
public Light(Game game, Lamp lamp, RotationAxis rotationAxis, Vector3 position) : base(game) { this.lamp = lamp; this.rotationAxis = rotationAxis; Power = true; DiffuseLightPower = defaultDiffuseLightPower; SpecularLightPower = defaultSpecualarLightPower; Position = position; LookAt = new Vector3(0.01f, 0.0f, 0.0f); CutOffAngle = defaultCutOffAngle; SpotLight = false; SelfShading = true; upVector = Vector3.Up; Rotate = false; AttenuationDistance = defaultLightAttenuationDistance; direction = 1.0f; }
public void RotateTetromino(RotationAxis axis, bool rotateClockwise) { switch (axis) { case RotationAxis.X: transform.DOBlendableRotateBy(Vector3.left * 90 * (rotateClockwise ? 1 : -1), ROTATION_DURATION); break; case RotationAxis.Y: transform.DOBlendableRotateBy(Vector3.up * 90 * (rotateClockwise ? 1 : -1), ROTATION_DURATION); break; case RotationAxis.Z: transform.DOBlendableRotateBy(Vector3.back * 90 * (rotateClockwise ? 1 : -1), ROTATION_DURATION); break; } UpdateBottomPart(); }
/// <summary> /// Gets the block ordered in a rotational order arround the provided axis. /// </summary> /// <param name="axis">Axis around which the blocks will be ordered.</param> /// <param name="isClockwise">Boolean indicating if whether the rotation direction is clockwise or not.</param> /// <returns>The ordered collection of blocks.</returns> private IList <IPositionnedByCartesian3dVector> GetOrderedBlocks(RotationAxis axis, bool isClockwise) { Plane p = new Plane(axis.Vector, 0.0); // Select all blocks that will be included in the rotation. var blocks = this.Blocks.Where(b => p.IsAbovePlane(b.Position)).OfType <IPositionnedByCartesian3dVector>().ToList(); if (blocks.Count == 0) { return(blocks); } blocks.Sort(new CircularVectorComparer(p)); if (!isClockwise) { blocks.Reverse(); } return(blocks); }
IEnumerator RotateCoroutine( RotationAxis axis, RotationEnum direction, float speed ) { if ( IsRotating ) { yield break; } if ( SpinSpeed < float.Epsilon ) { Debug.LogError( "SpinSpeed is less than or equal to 0" ); yield break; } RotationCollider activeCollider = null; switch ( axis ) { case RotationAxis.X: activeCollider = XRotationCollider; break; case RotationAxis.Y: activeCollider = YRotationCollider; break; case RotationAxis.Z: activeCollider = ZRotationCollider; break; } if ( activeCollider == null ) { Debug.Log( "WHHAATT" ); yield break; } Transform[] transformArray; Transform[] transformParentArray; { var quadList = activeCollider.GetAllObjectsToMove(); transformArray = quadList.Select( o => o.transform ).ToArray(); transformParentArray = transformArray.Select( t => t.parent ).ToArray(); } Vector3? rotationAxis = null; if ( direction == RotationEnum.Clockwise ) { switch ( axis ) { case RotationAxis.X: rotationAxis = new Vector3( x: 1, y: 0, z: 0 ); break; case RotationAxis.Y: rotationAxis = new Vector3( x: 0, y: 1, z: 0 ); break; case RotationAxis.Z: rotationAxis = new Vector3( x: 0, y: 0, z: 1 ); break; } } else { switch ( axis ) { case RotationAxis.X: rotationAxis = new Vector3( x: -1, y: 0, z: 0 ); break; case RotationAxis.Y: rotationAxis = new Vector3( x: 0, y: -1, z: 0 ); break; case RotationAxis.Z: rotationAxis = new Vector3( x: 0, y: 0, z: -1 ); break; } } if ( rotationAxis == null ) { Debug.Log( "WWWHHHHAATTT" ); yield break; } //switch ( axis ) //{ // case RotationAxis.X: Graph.RotateX( direction ); break; // case RotationAxis.Y: Graph.RotateY( direction ); break; // case RotationAxis.Z: Graph.RotateZ( direction ); break; //} IsRotating = true; CenterTransform.rotation = Quaternion.identity; for ( var i = 0; i < transformArray.Length; i++ ) { transformArray[ i ].parent = CenterTransform; } var progress = 0f; while ( progress < 1f ) { var angle = RotationCurve.Evaluate( progress ); CenterTransform.rotation = Quaternion.Euler( angle * rotationAxis.Value ); progress += Time.deltaTime * speed; yield return null; } CenterTransform.rotation = Quaternion.Euler( 90 * rotationAxis.Value ); for ( var i = 0; i < transformArray.Length; i++ ) { transformArray[ i ].parent = transformParentArray[ i ]; } CenterTransform.rotation = Quaternion.identity; yield return new WaitForSeconds( .1f ); IsRotating = false; yield return null; yield return null; }
private void OnCubeRotated( RotationAxis axis ) { // Store the rotation in the rotation list. Rotations.Add( axis ); }
/// <summary> /// Rotate around pitch, roll or yaw axis. /// </summary> /// <param name="axis">Axis</param> /// <param name="angle">Angle</param> private void Rotate(RotationAxis axis, float angle) { if (axis == RotationAxis.Yaw) yawRotation -= angle; else pitchRotation -= angle; /*left handed! if (axis == RotationAxis.Yaw) yawRotation += angle; else pitchRotation += angle; /*old from RC: Rotate( axis == RotationAxis.Pitch ? new Vector3(1.0f, 0.0f, 0.0f) : // Our world is xz based for some reason ^^ this way it works axis == RotationAxis.Roll ? new Vector3(0.0f, 0.0f, 1.0f) : new Vector3(0.0f, 1.0f, 0.0f), angle); */ }