Skip to content

Instantly share code, notes, and snippets.

@negipoyoc
Created December 16, 2018 02:45
Show Gist options
  • Save negipoyoc/f20a0ecf49068da4b1d4c857efc437b4 to your computer and use it in GitHub Desktop.
Save negipoyoc/f20a0ecf49068da4b1d4c857efc437b4 to your computer and use it in GitHub Desktop.
モデルを左右に揺らすだけのスクリプト
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