I'm worried that you are mixing two different movement systems, that could lead to weird behaviour. If you notice, you are using the transform to change the X and Z position, but using the rigidbody to do the jump on the Y-axis. Transform is literally setting the position of the cube in 3D space. But rigidbody is a part of the physics engine and you are applying a force and asking it to calculate it's position. It's usually best to stick to one or the other. Doing it all with position is not particularly arduous, most flappy bird implementations will do it.
Hi Jodi!! Thanks for the feedback, I didn't know that mixing the two was typically not a good idea, I'll try and update the article to stick to one or the other 😄
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'm worried that you are mixing two different movement systems, that could lead to weird behaviour. If you notice, you are using the transform to change the X and Z position, but using the rigidbody to do the jump on the Y-axis. Transform is literally setting the position of the cube in 3D space. But rigidbody is a part of the physics engine and you are applying a force and asking it to calculate it's position. It's usually best to stick to one or the other. Doing it all with position is not particularly arduous, most flappy bird implementations will do it.
Hi Jodi!! Thanks for the feedback, I didn't know that mixing the two was typically not a good idea, I'll try and update the article to stick to one or the other 😄