Animations Basics! How to Rotate Objects
Animation Tutorial for beginners. How to rotate objects in Unity. Using the Update() method, Unity Animation tools or a Tween tool like iTween or DOTween (HOTween v2)
❤️ Subscribe to Oxmond Tutorials:
https://bit.ly/SubscribeOxmondTutorials
✅ Download the free iTween tool here:
https://assetstore.unity.com/packages/tools/animation/itween-84?aid=1100l4p9k
✅ iTween documentation:
http://www.pixelplacement.com/itween/documentation.php
✅ Other free Asset Packages at the Unity Assets Store:
https://assetstore.unity.com/lists/top-free-packages-13201?aid=1100l4p9k
😷👕 Need a face mask / developer T-shirt? Drop by our shop and get a 20% DISCOUNT on your first purchase by using the discount code OXMONDSALE. Click here:
https://shop.oxmond.com/discount/OXMONDSALE
Rotate script:
/* .-------. .--. .-------. .--. .--. .--.
| |--.--.--------.-----.-----.--| | |_ _|--.--| |_.-----.----|__|---.-| |-----.
| - |_ _| | _ | | _ | | | | | | _| _ | _| | _ | |__ --|
|_______|__.__|__|__|__|_____|__|__|_____| |___| |_____|____|_____|__| |__|___._|__|_____|
© OXMOND / www.oxmond.com */
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Rotate : MonoBehaviour {
void Update () {
transform.Rotate(new Vector3(0f, 0f, 100f) * Time.deltaTime);
}
}
Set rotation:
transform.eulerAngles = new Vector3(0, 100f, 0);
Rotate iTween script:
/* .-------. .--. .-------. .--. .--. .--.
| |--.--.--------.-----.-----.--| | |_ _|--.--| |_.-----.----|__|---.-| |-----.
| - |_ _| | _ | | _ | | | | | | _| _ | _| | _ | |__ --|
|_______|__.__|__|__|__|_____|__|__|_____| |___| |_____|____|_____|__| |__|___._|__|_____|
© OXMOND / www.oxmond.com */
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RotateTween : MonoBehaviour {
public iTween.EaseType easeType;
public iTween.LoopType loopType;
void Start () {
iTween.RotateTo(this.gameObject, iTween.Hash("z", 180, "time", 1.5f, "easetype", easeType, "looptype", loopType));
}
}
[…] Animations Basics! How to Rotate Objects […]