如何在unity3d中給物體增加扭矩力
2020-12-11 20:49:19??????點(diǎn)擊:
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使用中更改界面字體大小顏色 2020/12/12
- 下一篇:U3d中如何給立方體的不同立面貼不同的紋理圖 2020/12/10


