- Home /
Jumping stops after certain collisions
Hello! I am a new unity user and I was following a tutorial on Unity but the jump script was not working well. I have a sphere character. I've tried many solutions but none have worked. Basically, when my ball moves from one cube to another, it won't jump at all anymore. This also happens if I hit a slope or a ceiling. JavaScript script by the way. Script: #pragma strict
var rotationSpeed = 100;
var jumpHeight = 8;
private var isFalling = false;
function Update ()
{
//moves ball left and right
var rotation : float = Input.GetAxis ("Horizontal") * rotationSpeed;
rotation *= Time.deltaTime;
rigidbody.AddRelativeTorque (Vector3.back * rotation);
if (Input.GetKey(KeyCode.UpArrow) && isFalling == false)
{
rigidbody.velocity.y = jumpHeight;
isFalling = true;
}
}
function OnTriggerEnter()
{
isFalling = false;
}
function OnTriggerExit()
{
isFalling = true;
}
A picture of one of the areas my jump breaks: http://puu.sh/9IzmO/6f9175bf9c.jpg Thanks in advance
Perhaps you want OnCollisionEnter
ins$$anonymous$$d of OnTriggerEnter
.
Other possibility: are you sure your collisions are being detected at all? Debug.Log is sometimes very helpful to track this sort of thing.
See this tutorial for more info.
OnCollisionEnter doesnt change it, if i change platforms or touch a wall it still breaks
Your answer
![](https://koobas.hobune.stream/wayback/20220613152434im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
My character double jumps if he runs, before jumping?? 1 Answer
jump on collision - first person controller 0 Answers
Jumping on top of an enemy problem 1 Answer
Character jump on collision 1 Answer
2d Platformer Jumping Not Working 1 Answer