does anyone know how to do a proper parabolic travel? with dynamic height and speed?.
if anyone know please do share.
also this is between two known points
does anyone know how to do a proper parabolic travel? with dynamic height and speed?.
if anyone know please do share.
also this is between two known points
Some formulas in here might help you understand the concept of moving something along a path.
Also this might help:
http://luminaryapps.com/blog/arcing-projectiles-in-unity/index.html
Written by forum member @JoeStrout
problem is how would i go about making the height dynamic? since its extreamly important that it has that
The height in Joe’s method is dynamic. You sinmply change the height variable. Maybe you could describe your use, because I am not understanding what you want to do with it?
height as in i dont know the Height required. since every point of jump is different thats what i mean. and since its a 2d platformer the variation in jump height required is vastly different
mhm for some reason it works but it also doesn’t when ever it jumps from platform to platform it rams directly through it. as if no collision occurs
nevermind found a solution that seems to work fine. and i found the dynamic height by finding the difference in the two objects height
Just for clarification, the height variable sets the peak of the parabola. So if you want the character to jump high and then land on the platform, use a value higher than the difference. If you want the character to jump as high as the platform, use the difference.
Try different values and see the results in your Editor.
I would just like to point out that Joe’s solution is a good approximation, not an exact solution. If you want an exact solution, you need to do some basic differential calculus. Obviously, once you do your first integral, you’ll have an initial velocity variable (or angle depending on what you integrate over) which you’ll have to decide on (because there are an infinite number of parabolas between any two points.) If you know your max height, then you can plug it into another differential to determine those from h = (v[initial]^2 sin^2(angle)) / 2g
infact my biggest problem right now is getting a proper solution to pathfinding. that includes the AI knowing when to jump and not to jump and this is in a 2D Platformer
I spent quite a bit of time trying to roll my own pathfinding system for a 2D platformer. I ended up creating a grid system, and gave each grid square a box collider trigger and script component that would hold its coordinate, as well as a bool that I could set if it was navigable. Then I used a great 2D pathfinding API (GitHub - RonenNess/Unity-2d-pathfinding: A very simple 2d tile-based pathfinding for unity, with penalty supported) and used it in conjunction with my grid to determine which coordinate each enemy and player was.
IIRC, I would get a path, which was a list of coords, and iterate through each one getting its position. Then I could check which direction the next move was, and jump up if it was N, NE or NW, and jump down if it was SE or SW. Little buggers were difficult to avoid! Got it working, but then abandoned the project.