microsoftv Advanced Cheater Reputation: 0
Joined: 07 Apr 2016 Posts: 82 Location: U.S
|
Posted: Sat Oct 08, 2016 6:47 pm Post subject: Formula for trajectory of object reflecting on walls? |
|
|
I'm coding a bot for a 2d game that uses only rectangular planes and uses degrees for angles (but in weird fashion). However I don't know a formula (more or less, there isn't one) that can determine trajectory of an object with infinite speed and no gravity, however because it has infinite speed, whenever the object hits a wall, there is a 200 millisecond delay before it moves from the wall again, after 200 ms is up, the trajectory/angle is reflected depending on if it hit the ceiling (y-axis) or the wall (x-axis). An example for a straight angle is determined by if the ytrajectory is = 0 and the xtrajectory is 65536, if the xtrajectory is - then it is going left, positive is right, if ytrajectory is positive, it's going down, negative, up. I need to determine if that object will end up hitting the bot the next time it reflects it's angle off of a wall/ceiling. Here is another example of a down, left angle, the xtrajectory = -32768, ytrajectory = 56756:
|
|