Skip to content

Instantly share code, notes, and snippets.

@JunShimura
Last active October 26, 2015 06:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JunShimura/b3a4cdff56a525d0f24c to your computer and use it in GitHub Desktop.
Save JunShimura/b3a4cdff56a525d0f24c to your computer and use it in GitHub Desktop.
[超初心者向け]Unityチュートリアル「はじめてのUnity」のブロック崩しと同等をC#で::(4)ラケットを動かす ref: http://qiita.com/JunShimura/items/5fac20966bba6b223427
using UnityEngine;
using System.Collections;
public class Racket : MonoBehaviour {
private float accel = 1000.0f;//加える力の大きさ
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
//力を加える
this.GetComponent<Rigidbody>().AddForce(
transform.right*Input.GetAxisRaw("Horizontal")*accel,
ForceMode.Impulse);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment