I really wanted to do this first project myself but it's been days and I have no clue what's wrong haha. I'm making a 2D platformer where you jump from rock to rock and have to balance yourself. This balancing also affects your jumps, since tilting more to one side makes for longer horizontal jumps but lower for vertical. As you balance yourself to make your next jump, you should get a Line2D that describes the trajectory you'd take if you made the jump at that instant.

I'm completely puzzled because despite providing the same initial velocities (x and y) and how they decay over time, the predicted trajectory is still underestimating the true trajectory. I've tried printing positions and velocities for each physics frame for both, but I still can't find what's wrong. They both appear to change their position in the right way.

Here's the code for the CharacterBody2D on github
Pics attached is how these nodes are organized.

I also found something weird. I wanted to see what both reported as their highest point (when y velocity starts becoming positive and thus starts falling down), and they both report the same coordinates, yet visually they don't match up. For one jump, it printed:
player starts at (141, 236)
player highest position: (390, 60)
so relative position: (249, -176)

prediction starts at (0,0)
prediction highest position: (249, -176)

So I also made visual indicators in these same points. Player turns blue when reaching the highest reported point. Prediction ends on highest reported point (seen after landing on the ground). Now I'm puzzled because they report the same change of position from their starting positions, and yet the visual indicators show otherwise. Here's a clip:
(btw both the CharacterBody2D and Line2D are in the same position in the editor)

  • It's because your player node is scaled down, and the parabola is childed to it, making the parabola scaled down but the physics is not.

It's because your player node is scaled down, and the parabola is childed to it, making the parabola scaled down but the physics is not.

    award That was it!! Thank you so much, it was driving me insane hahaha