- Home /
Sphere get stuck in floor and fails to jump?
I have a rigid body with a sphere collider sitting on a floor. It has this in fixed update:
if (Input.GetKeyDown(KeyCode.Space))
{
rigidbody.velocity = Vector3.up * 4;
}
If I try to jump as soon as the sphere reaches the floor, it will occasionally fail to jump (remains stationary). Since I am setting velocity directly instead of incrementing it, I know it isn't being cancelled out by any existing negative velocity. Also, I don't have any logic to ensure that the player is on the ground before letting them jump, so that's not the problem either.
Any thoughts on how to fix this? Thanks.
Doubt this is the problem but usually Input gets checked in the normal update function..
Nope, that doesn't fix it, but thanks, I'll keep that in $$anonymous$$d.
So if the sphere is in the air it will always move upwards but if it is touching the ground it sometimes fails to move?
Under Detonator,explosion effects. will cause object jump, dunno if it does help to you as you can check it up
Hey wenhua, answered your question http://answers.unity3d.com/questions/206791/how-to-make-a-sphereball-blinking.html I'm curious to find out whether it works xD
Answer by ByteSheep · Jan 20, 2012 at 05:55 PM
For anyone else with this problem make sure to check for input in the regular Update() function and not in the fixed update function :)
Your answer
Follow this Question
Related Questions
Keep Horizontal Momentum after Jump 2 Answers
Player object falling through game environment, collision not detected with ground 0 Answers
How can I make a physics object jump a given height on collision regardless of current velocity? 1 Answer
Collisions causing Rigidbody to go Haywire and move randomly. 1 Answer