I looked deep in to some other forum posts but they have stuff like “isFalling” am not that good with Scripting, but I still understand why they would do that. but still to my question. This is the code:
if (Input.GetKey (KeyCode.Space)) {
rigidbody.AddForce (Vector3.up * 5);
}
Now I have 2 problems:
- I can’t seem to get
KeyCode.Space
to work, I can get("up")
to work but not Space. - Is there away to make it so its more of a “Jump” because its more like its just going up.
Am very slowly learning but I think am doing OK since I started this project 2 days ago (from the date this is posted) plus I have college and stuff (Life story FTW).
UPDATE:
This is the script I have:
var jump : float = 15f;
function Update (){
if(Input.GetKey(KeyCode.Space)){
//rigidbody.velocity = Vector3(0 ,jump,0 );
rigidbody.AddForce(Vector3.up * jump);
}
}
I can hold the space bar in and go as high as I would like. I want to remove this and make it so its just s jump.
Thanks