Skip to content

Commit 4283df6

Browse files
authored
Merge pull request #90 from Unity-Technologies/UNI-23253-add-turntable-animation
UNI-23253 add rotate animation to model
2 parents c184e12 + 99f95cf commit 4283df6

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Assets/FbxExporters/Editor/ReviewLastSavedModel.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ private static Object LoadModel (string fbxFileName)
8181
modelGO = UnityEditor.PrefabUtility.InstantiatePrefab (unityMainAsset) as GameObject;
8282

8383
GameObject turntableGO = GameObject.Find ("TurnTable");
84-
if (turntableGO!=null)
85-
{
84+
if (turntableGO != null) {
8685
modelGO.transform.parent = turntableGO.transform;
86+
turntableGO.AddComponent<RotateModel> ();
87+
} else {
88+
modelGO.AddComponent<RotateModel> ();
8789
}
8890
}
8991

Assets/FbxExporters/RotateModel.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
public class RotateModel : MonoBehaviour {
6+
7+
[Tooltip("Rotation speed in degrees/second")]
8+
[SerializeField]
9+
private float speed = 10f;
10+
11+
void Update () {
12+
transform.Rotate (Vector3.up, speed * Time.deltaTime, Space.World);
13+
}
14+
}

0 commit comments

Comments
 (0)