반응형
Notice
Recent Posts
Recent Comments
«   2025/01   »
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
Archives
Today
Total
관리 메뉴

Do Something IT

FlyingMover 본문

Unity3D

FlyingMover

아낙시만더 2014. 4. 28. 14:39
반응형
public class FlyingMover : MonoBehaviour
{
    public float m_Speed = 5.0f;
    public float m_Height = 3.0f;
    public float m_ForwardMoveSpeed =0.0f;
    float m_Value = 0.0f;
    float m_YSin = 0.0f;
    Transform m_Transform;

    void Start() 
    {
        m_Speed *= 0.001f;
        m_Height *= 0.1f;
        m_ForwardMoveSpeed *= 0.0001f;
        m_Transform = transform;
    }

    void Update()
    {
        CharacterUpdateSin();
    }

    void CharacterUpdateSin()
    {
        m_Value += m_Speed;
        m_YSin = (float)Mathf.Sin(m_Value) * m_Height;
        m_Transform.position = new Vector3(m_Transform.position.x + m_ForwardMoveSpeed, m_YSin, 0);
    }
}

반응형
Comments