Last active
October 26, 2015 06:53
-
-
Save JunShimura/b3a4cdff56a525d0f24c to your computer and use it in GitHub Desktop.
[超初心者向け]Unityチュートリアル「はじめてのUnity」のブロック崩しと同等をC#で::(4)ラケットを動かす ref: http://qiita.com/JunShimura/items/5fac20966bba6b223427
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 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