My simple object won't execute any commands
I am working on a simple game involving an object the moves 3 dimensionally, jumps, and shoots. I have a script, Unity doesn't say anything is wrong with the script but my object won't move. Here is my script. Please help!!?
pragma strict
var Player : GameObject; var MovingSpeed : float; var TurningSpeed : float; var JumpingPower : float;
var NewBullet : GameObject; var fireFreq : float; private var lastShot : float;
function Start () {
}
function Update () {
if( Input.GetKey(KeyCode.W) ){
Player.GetComponent.<Rigidbody>().AddRelativeForce(Vector3.forward * MovingSpeed);
}
if( Input.GetKey(KeyCode.S) ){
Player.GetComponent.<Rigidbody>().AddRelativeForce(Vector3.forward * MovingSpeed * -1);
}
if( Input.GetKey(KeyCode.A) ){
Player.transform.Rotate(Vector3.up * TurningSpeed * -1);
}
if( Input.GetKey (KeyCode.D) ){
Player.transform.Rotate(Vector3.up * TurningSpeed);
}
if( Input.GetKeyDown(KeyCode.J) ){
Player.GetComponent.<Rigidbody>().AddRelativeForce(Vector3.up * JumpingPower);
}
}
What have you set your $$anonymous$$oving and Turning speed to? You may also need to...
if( Input.Get$$anonymous$$ey($$anonymous$$eyCode.W) ){
Player.GetComponent.<Rigidbody>().AddRelativeForce(Vector3.forward * $$anonymous$$ovingSpeed * time.deltaTime);
}
Your answer
Follow this Question
Related Questions
Controller / movement script rotate while moving HELP 0 Answers
How to control how far a character can jump 0 Answers
How do i move a cube like an actual cube?,How Can i Move a Cube? 0 Answers
How to block one input while another is in use? 1 Answer
Can't jump when moving backwards and to the right or left (C#) 1 Answer