Skip to content

Commit 570d412

Browse files
committed
add rotate animation to model
or to TurnTable if present
1 parent 81d13f5 commit 570d412

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
public class RotateModel : MonoBehaviour {
6+
7+
public float speed = 10f;
8+
9+
void Update () {
10+
transform.Rotate (Vector3.up, speed * Time.deltaTime);
11+
}
12+
}

0 commit comments

Comments
 (0)