열차 목업의 내부 확인용 프로젝트
smchoi
2024-07-24 ff74c0073046f0e086eb7d355950bda39937c92c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//////////////////////////////////////////////////////
// MK Glow Rotate Object                             //
//                                                    //
// Created by Michael Kremmel                       //
// www.michaelkremmel.de                            //
// Copyright © 2017 All rights reserved.            //
//////////////////////////////////////////////////////
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
namespace MK.Glow.Example
{
    public class RotateObject : MonoBehaviour
    {
        [SerializeField]
        private Vector3 _rotation = Vector3.zero;
        private readonly float _heightMovement = 0.125f;
        private readonly float _heightMovementSpeed = 1f;
 
        private Vector3 _startPosition;
 
        private void Awake()
        {
            _startPosition = transform.position;
        }
 
        void Update()
        {
            transform.Rotate(_rotation * Time.smoothDeltaTime);
            transform.position = _startPosition + Vector3.up * _heightMovement * Mathf.Sin(Time.time * _heightMovementSpeed);
        }
    }
}