- Home /
Help on Jumping
I was able to have my character jump in the air but he doesn't land. When I applied the gravity on my rigibody, I just get a game over as soon as I start my level. Without the gravity, my level runs smoothly. Any suggestions?
here's the script I'`m using for jumping
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void FixedUpdate() {
if (Input.GetButtonDown("Jump"))
rigidbody.velocity = new Vector3(0, 10, 0);
}
}
Note: Not using character controller
Answer by sparkzbarca · Oct 15, 2012 at 11:54 PM
your jump is fine. gravity is fine. the game over is whats bugged.
Do you get game over when your character dies? ok what causes him to die? im guessing if you did a Debug.log on the variable that changes when he dies you'd see he was insta dying.
That means gravity is pushing him against something and touching that something is killing him.
So you need to post your game over code if you want help.
Remember the terrain is a collider. touching a collider and dying means touching the terrain kills him.
Your answer
![](https://koobas.hobune.stream/wayback/20220613082407im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Errors with gravity switching... 1 Answer
Best way to access a script component without knowing it's name? 4 Answers
Fps Aiming Script help 2 Answers