I am literally just wanting someone to help me with an equation to calculate the exact Y position of a jump at a given distance away from the starting point. Something I can put into a script, run it, and have one number result.
This diagram below should help explain what I am needing.
Not sure if this is what you’re looking for, but here’s the equations that relate to an object in flight undergoing forces such as velocity and acceleration, I’ve used these for multiple projectile systems and I think you could integrate them:
Equation for Position
Where x is Current Position (Vector3) Where x0 is Previous position (Vector3) Where V0 is previous Velocity (Vector3) Where t is Time (number) Where a is Acceleration (Vector3)
x = x0+V0t+0.5at^2
Equation for Velocity
Where V is Current Velocity (Vector3) Where V0 is Previous Velocity (Vector3) Where a is Acceleration (Vector3) Where t is Time (number)
V = V0 + at
You can input a single time, a starting velocity, a starting position, and acceleration into these equations and get an accurate position, with X, Y, and Z Values.
The Velocity includes direction so does the Acceleration.
I am trying to find out, for example, how high the parabola would be at 1 studs away from the starting point or 2 studs away from the starting point (the starting point is the character’s Torso).
I am using this to help calculate if a landing point would be met at any given studs away (if the Y is higher than the landing point’s Y).
You can get the exact position the parabola will land on by first, calculating the angle of the character from unit 0, should be pretty simple, and then just use this formula:
local point = char.Position + Vector3.new(
rad * math.cos(theta), 0,
rad * math.sin(theta)
)
If you can calculate the parabolas x dimension at any y coordinate, just plug the y=0 and it should give you the x dimension at y=0, add it to the x value at y=char.Position.Y, and put it in the equation as rad (radius). That should give you the landing point.
Sorry for my undescriptive explanation, this is what I mean:
local function getParabolaX(y)
return -- your code here
end
local function getLandingPoint()
local charCFrame = char:GetPivot()
local charAngleY = select(2, charCFrame:ToEulerAnglesXYZ())
local charParabolaX = getParabolaX(charCFrame.Position.Y)
local groundParabolaX = getParabolaX(0)
local parabolicRadius = charParabolaX + groundParabolaX
local positionFromCharAngle = charCFrame.Position + Vector3.new(
parabolicRadius * math.cos(math.rad(charAngleY)), 0
parabolicRadius * math.sin(math.rad(charAngleY))
)
return positionFromCharAngle
end
What this script does is basically, calculate the magnitude vector between the character and the ground point where it intersects with whatever, and then it uses it as the radius in a circle and then finds a point on its circumference with the character’s Y orientation.
The getParabolaX(y) should give you x in this diagram:
Thank you for this, and it’s just that I’m slow when it comes to math and y = and all that. Thanks for taking the time, and the drawing is fine, but there is 2 x’s?
How do I put the distance away here when there is a y variable or whatever its called? So like if I wanted to calculate 3.5 studs away from the charCFrame, I couldn’t just say return 3.5 because there is a y that needs to be considered or factored in?
Sorry for my confusion, I think I might just give up.
The x on the peak represents x=0 and the second one represents the length of the line from the edge point that corresponds to the y value to the center of the parabola.
Unfortunately the x value needs to be computed based on a y value.
All this math might be terrifying but keep on going. You’ll eventually achieve what you need.
No no you don’t need to factor in a second axis to this lol, 1 axis will work fine.
Based on the images you posted tho, it seems to be the z axis that you want to use.