My game is a 3d platformer. I have some pressureplates in my scene, and when u step on them u get like a “forcejump”. U get fired up in the air like when u jump. The problem is when i step on one of them, and afterwards land on one of the other plates, i fly much further up. How can i make it so i only jump the same height everytime?
Here is my script, its pretty basic so i dont think i have to say anything more than the “jump” tag is the plates.
#pragma strict
var speed : int = 10;
function Start () {
}
function Update () {
if(Input.GetKey("a")) {
transform.Translate(Vector3(-speed,0,0) * Time.deltaTime);
}
if(Input.GetKey("s")) {
transform.Translate(Vector3(speed,0,0) * Time.deltaTime);
}
}
function OnTriggerEnter (other : Collider) {
if(other.gameObject.tag == "jump") {
print("JUMP");
GetComponent.<Rigidbody>().AddForce(Vector3.up * 500);
}
}