我當前已得到了我的角色在空中飛行與下面的腳本飛行角色
#pragma strict
var cMotor: CharacterMotor; // reference to the CharacterMotor script
function Start(){ // get the CharacterMotor script at Start:
cMotor = GetComponent(CharacterMotor);
}
function Update(){ // move player upwards while F is pressed
if (Input.GetKey("f")){
cMotor.SetVelocity(Vector3.up*10.5);}
else if (Input.GetKey("up")){
cMotor.SetVelocity(Vector3.forward*10.5);
}
else if (Input.GetKey("left")){
cMotor.SetVelocity(Vector3.left*10.5);
}
else if (Input.GetKey("down")){
cMotor.SetVelocity(Vector3.back*10.5);
}
else if (Input.GetKey("right")){
cMotor.SetVelocity(Vector3.right*10.5);
}
else if (Input.GetKey("g")){
cMotor.SetVelocity(Vector3.down*10.5);
}
}
// This do-nothing function is included just to avoid error messages
// because SetVelocity tries to call it
function OnExternalVelocity(){
}
但是我希望能夠凍結角色在空中,使他們不落,但如果我設置maxFallSpeed爲0,那麼我不能再讓角色降落。有任何想法嗎?
我相信這是java腳本,值得將該標記添加到您的問題。 – 2014-02-11 09:19:35