Created
December 16, 2018 02:45
-
-
Save negipoyoc/f20a0ecf49068da4b1d4c857efc437b4 to your computer and use it in GitHub Desktop.
モデルを左右に揺らすだけのスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Swing : MonoBehaviour | |
{ | |
public float speed = 200; | |
public float range = 0.1f; | |
void Update() | |
{ | |
var x = range * Mathf.Sin(Mathf.Deg2Rad * Time.time * speed); | |
transform.position = new Vector3(x, 0, 0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment