- #1
rippy
- 1
- 0
I'm kind of embarrassed I can't figure this out on my own... It's to be used to determine the movement of objects in a game (2d space). This is quite obviously something that has been solved many times over, but I haven't had any luck searching for an answer, so I thought I'd try here!
You're given an initial xy-coordinate, an initial velocity vector, a target xy-coordinate, and the magnitude of the acceleration vector. The goal is one of the following:
(a) Find a single acceleration vector which ensures the object reaches the point (i.e. passes through the point).
(b) Determine how to apply acceleration such that velocity is zero when the target is reached (i.e. stop on the point)
I've been primarily trying to figure out the easier (a), but I'd like to figure both out eventually.
Formulae for acceleration, velocity an position relative to time (these seem obvious so I'll omit them, hope that's okay).
For (a): The object is at the point if its x-coordinate and y-coordinate match the target's coordinates at the same time. We can look at the separate x and y equations for calculating the object's position based on acceleration, time, initial velocity and initial position; then, by solving for time, we can equate them. Since we know the magnitude of the acceleration, and [itex](a_x)^2 + (a_y)^2 = a[/itex], we have two equations and two unknowns and can solve. However, you end up with two equated quadratic formulae which is a huge pain to attempt to solve.
My next thought was to just try to calculate the ratio of [itex](a_x)/(a_y)[/itex], but I've had no luck with that either.
This isn't homework, so there's no need to be cryptic! It seems like somewhat of a homeworkey problem though so I thought it would be most appropriate to post here anyway. Currently my game objects are moving around at constant velocity and it is not satisfying at all.
Any help is appreciated, thanks!
Homework Statement
You're given an initial xy-coordinate, an initial velocity vector, a target xy-coordinate, and the magnitude of the acceleration vector. The goal is one of the following:
(a) Find a single acceleration vector which ensures the object reaches the point (i.e. passes through the point).
(b) Determine how to apply acceleration such that velocity is zero when the target is reached (i.e. stop on the point)
I've been primarily trying to figure out the easier (a), but I'd like to figure both out eventually.
Homework Equations
Formulae for acceleration, velocity an position relative to time (these seem obvious so I'll omit them, hope that's okay).
The Attempt at a Solution
For (a): The object is at the point if its x-coordinate and y-coordinate match the target's coordinates at the same time. We can look at the separate x and y equations for calculating the object's position based on acceleration, time, initial velocity and initial position; then, by solving for time, we can equate them. Since we know the magnitude of the acceleration, and [itex](a_x)^2 + (a_y)^2 = a[/itex], we have two equations and two unknowns and can solve. However, you end up with two equated quadratic formulae which is a huge pain to attempt to solve.
My next thought was to just try to calculate the ratio of [itex](a_x)/(a_y)[/itex], but I've had no luck with that either.
This isn't homework, so there's no need to be cryptic! It seems like somewhat of a homeworkey problem though so I thought it would be most appropriate to post here anyway. Currently my game objects are moving around at constant velocity and it is not satisfying at all.
Any help is appreciated, thanks!