public void RotateTo(float _angleRange, int _axis, float _duration) { isRotating = false; rotationType = CTRotationType.Uniform; initRotateArgument(_angleRange, _axis, _duration); switch (rotateAxis) { case 0: // Rotate around axis X { rotateVector = Vector3.right; break; } case 1: // Rotate around axis Y { rotateVector = Vector3.up; break; } case 2: { rotateVector = Vector3.forward; break; } default: break; } deltaRotate = angleRange / rotateDuration; isRotating = true; }
public void RotateTo(float _angleRange, int _axis, float _duration, float _acclerationDuration) { isRotating = false; rotationType = CTRotationType.AccelerateUniformly; rotateAccleration = 1 / ((rotateDuration - accelerateDuration) * accelerateDuration); initRotateArgument(_angleRange, _axis, _duration); switch (rotateAxis) { case 0: // Rotate around axis X { rotateVector = Vector3.right; break; } case 1: // Rotate around axis Y { rotateVector = Vector3.up; break; } case 2: { rotateVector = Vector3.forward; break; } default: break; } accelerateDuration = _acclerationDuration; isRotating = true; }
private void initRotateArgument(float _initAngleRange, int _initRotateAxis, float _initRotateDuration) { rotateAxis = _initRotateAxis; rotateDuration = _initRotateDuration; leftDuration = _initRotateDuration; angleRange = _initAngleRange; rotationType = CTRotationType.Uniform; }