敵を動かす④(揺れながら移動)



左右に揺れながら移動
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ShakeMove : MonoBehaviour
{
private void Update()
{
// 三角関数の活用(Sin関数)
transform.Translate(5.0f * Time.deltaTime * Mathf.Sin(Time.time * 2), -Time.deltaTime * Mathf.Sin(Time.time), 0);
}
}




【2019版】Danmaku Ⅱ(基礎2/全38回)
他のコースを見る


左右に揺れながら移動
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ShakeMove : MonoBehaviour
{
private void Update()
{
// 三角関数の活用(Sin関数)
transform.Translate(5.0f * Time.deltaTime * Mathf.Sin(Time.time * 2), -Time.deltaTime * Mathf.Sin(Time.time), 0);
}
}




敵を動かす④(揺れながら移動)