unity 添加刚体力

using UnityEngine;
using System.Collections;

public class addFore : MonoBehaviour {

    private GameObject box;

    // Use this for initialization
    void Start () {
        box = GameObject.Find ("1");
    }
    
    // Update is called once per frame
    void Update () {
    
    }

    void FixedUpdate()
    {

        box.GetComponent<Rigidbody2D>().AddForce(new Vector2(0f, 10f));
    }
}

 

posted @ 2015-03-19 14:04  yufenghou  阅读(711)  评论(0编辑  收藏  举报