- Home /
Question by
isaacduncan02 · Jul 08, 2018 at 07:06 AM ·
physicsvelocityprojectile
trajectory motion predictor
Vector3 CalculateArcPoint(float t, float maxDistance)
{
float x = t * maxDistance; //ensure proper spacing
float y = x * Mathf.Tan(radianAngle) - ((gravity * x * x) / (2 * velocity * velocity * Mathf.Cos(radianAngle) * Mathf.Cos(radianAngle))); //parabola of curve to find pos y
Vector3 point = new Vector3(x + playerPos.position.x, y + playerPos.position.y); //adding offset
return point; //returns to array for lineRenderer
}
in my game i have ball jumping from left to right on the screen in a parabola curve. When it jumps to the right so X-component of the velocity is positive my line render correctly shows its predicted pathway but when its jumping from the otherside(to the left) all the points in the x-axis are shifted to the right as if its jumping to the right again. (The y-axis points are fine). Am not sure what the problem is here?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612170248im_/https://answers.unity.com/themes/thub/images/avi.jpg)