Skip to content

Commit 481273e

Browse files
committed
move RotateModel functionality to FbxTurnTableBase
If not turn table exists then create an empty GO to be the turntable
1 parent eeb0f31 commit 481273e

File tree

3 files changed

+14
-33
lines changed

3 files changed

+14
-33
lines changed

Assets/FbxExporters/Editor/ReviewLastSavedModel.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,12 @@ private static Object LoadModel (string fbxFileName)
9696
turntableGO = turnTableBase.gameObject;
9797
}
9898

99-
if (turntableGO != null) {
100-
modelGO.transform.parent = turntableGO.transform;
101-
} else {
102-
if (!modelGO.GetComponent<RotateModel> ()) {
103-
modelGO.AddComponent<RotateModel> ();
104-
}
99+
if (turntableGO == null) {
100+
turntableGO = new GameObject ("TurnTableBase");
101+
turntableGO.AddComponent<FbxTurnTableBase> ();
105102
}
103+
104+
modelGO.transform.parent = turntableGO.transform;
106105
}
107106

108107
FrameCameraOnModel (modelGO);

Assets/FbxExporters/FbxTurnTableBase.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,16 @@
1111

1212
namespace FbxExporters.Review
1313
{
14-
public class FbxTurnTableBase : RotateModel
14+
public class FbxTurnTableBase : MonoBehaviour
1515
{
1616

17+
[Tooltip ("Rotation speed in degrees/second")]
18+
[SerializeField]
19+
private float speed = 10f;
20+
21+
void Update ()
22+
{
23+
transform.Rotate (Vector3.up, speed * Time.deltaTime, Space.World);
24+
}
1725
}
1826
}

Assets/FbxExporters/RotateModel.cs

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)