unity3d給物體增加扭矩力
2019/4/9??????點擊:
using UnityEngine; using System.Collections; public class AddTorqueExample : MonoBehaviour { public float amount = 50f; void FixedUpdate () { float h = Input.GetAxis("Horizontal") * amount * Time.deltaTime; float v = Input.GetAxis("Vertical") * amount * Time.deltaTime; rigidbody.AddTorque(transform.up * h); rigidbody.AddTorque(transform.right * v); } }
- 上一篇:unity3d將C#類封裝打包成DLL 2019/5/7
- 下一篇:unity3d物體移動的方法 2019/4/9