In a situation where an object is thrown, a rock or maybe even a grenade, how would you simulate the arc being thrown?
How would you be able to calculate the trajectory of the object?
When answering do not worry about the Z-Axis, I am asking this question in regards to simple 2D coordinates.
To visualize the motion I am trying to achieve, Trajectory
Well, in physics, there are multiple formulas for the topic of trajectories. I'm assuming what you're looking for is the X and Y position of the projectile after a given time, given the angle of launch and the initial velocity.
First you need to find the velocity components for the X and Y values.
Vi = Initial Velocity
A = Angle of Launch
Vx = Vi * cos(A)
Vy = Vi * sin(A)
Now that we have the velocities in the X and Y directions, we can use that to get the position of a projectile after a specific amount of time.
T = Time in seconds
G = 196.2 (This is the acceleration due to gravity in roblox. In the real world, it's 9.81)
Px = Vx * T
Py = Vy * T - (0.5 * G * T^2)
Now we know the X and Y positions of a projectile at a given time.
You can use this to move a projectile by incrementing the time by small amounts and then positioning the projectile at the calculated location, or you can use this to predict the path of a projectile.
Hope this helped!
Further resources: Projectile Motion