-
MovePosition
查看全部 -
獲取該obj的this.transform, this.GetCompoent<Rigidbody>();
查看全部 -
剎車(chē)處理
rigid.velocity = Vector3.Lerp(rigid.velocity, new Vector3 (0, rigid.velocity.y, 0) , 0,2f);
查看全部 -
private bool brake
brake = Input.GetKey(KeyCode.Space);
按下空格 剎車(chē)
查看全部 -
update 里面接受鍵盤(pán)wsad的input
dir = Vector3(Input.GetAxis("Horizontal"),0,Input.GetAxis("Vertical"));
查看全部 -
Is Kinematic 如果勾選了就是絕對(duì)靜止
Interpolate 差值, 使得物體的移動(dòng)更加的自然,但是弊端就是可能與物體的渲染不同步,則會(huì)看到抖動(dòng)
查看全部 -
1313查看全部
-
5.平臺(tái)移動(dòng)MovePositon();方法
private Transform m_Plate;
private Rigidbody m_plate;
private int direction=1;
public float speed=1;
void Start(){
m_Plate=this.transform;m_plate=GetComponent<Rigidbody>();
}
void Update(){
if(m_Plate.position.x>=5&&direction>0){
direction=-1;else if(m_Plate.position.x<=-6&&directon<0){
direction=1;}
void FixedUpdate(){
m_Plate.MovePositon(vector3.x*speed*direction*Time.Fixeddatetime);查看全部 -
5.陷阱三
private Rigidbody m_cycle;
void Start(){
m_cycle=this.GetComponent<Rigidbody>();}
void FixdeUpdate(){
m_cycle.angularVelocity=vector3.up*speed;}
查看全部
舉報(bào)