- Home /
Help with jetpack script
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.
Answer by w212ds · Jul 27, 2015 at 04:48 AM
You should research before you ask a question. Check this:https://www.youtube.com/watch?v=OIPpU7_RNVM Also provide more information is this game 2D or 3D?
$$anonymous$$y apologies, I should have made myself more clear. I am using the standard First Person Controller. This is a 3D First Person Shooter game. Also, thank you for the link. I googled it, but never found that.
I appreciate the video, but it was made for unity 4. I am using unity 5, so there is no Character$$anonymous$$otor script (which all of these videos depend on.)
Same problem with me, no motor script .-. So, have you found a fix?
Also, sorry for necro posting.
Your answer
Follow this Question
Related Questions
Cursor Not Centered 0 Answers
Where do I start in unity, multiplayer spe 2 Answers
Can you change the speed of a raycast? 1 Answer
Play Audio from different Object 1 Answer
Pushing rigidbody with FPS Controller 3 Answers