I’m trying to add a jetpack to my (Standard) FirstPersonController script. However, I’ve found no way that seems to work. I tried doing it with the Rigidbody component, but then my player would seemingly bounce around on the ground. Then I used this code:
if (Input.GetKey (KeyCode.LeftAlt)) {
PlayerVelocity = PlayerVelocity + UpForce;
}
if (PlayerVelocity > 0 && !Input.GetKey (KeyCode.LeftAlt)) {
PlayerVelocity = PlayerVelocity / 8;
}
transform.position = new Vector3 (transform.position.x, transform.position.y + PlayerVelocity, transform.position.z);
It worked, but it would randomly drop me and then keep going up. I finally tried this:
controller.Move (transform.up * UpForce);
But it was to no avail. I can’t seem to get a jetpack to work. Does anyone have any ideas?
By the way, the script is attatched to my FirstPersonController prefab. Also, the “controller” variable was assigned.