 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
zm0d Master Cheater
Reputation: 7
Joined: 06 Nov 2013 Posts: 423
|
Posted: Mon May 23, 2016 8:53 am Post subject: Flying object - prediction line |
|
|
Hi
lets assume I have an object like an arrow that gets shot by a bow.
How can I calculate and draw a "prediction" line for this flying arrow?
Is there usually a data array that gets filled as soon as I shoot the arrow in the air with all the 3D position structures?
Would I read this array and then draw points on the screen regarding to all the positions I find in-memory?
|
|
| Back to top |
|
 |
++METHOS I post too much
Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Mon May 23, 2016 4:07 pm Post subject: |
|
|
It depends on that target and how that data is being handled. For most games, the projectile has xyz coordinates, just like everything else. Also, if you have a reticle or crosshair (visible or not), these may also have xyz coordinates for 3-D and/or xy values for 2-D coordinates. In other words, you can determine where your arrow is going to go, three-dimensionally, before you even shoot it.
The xyz may not exist for the projectile until you fire your weapon. However, the xyz for reticle/crosshair etc. may always be present.
Not all games handle the data in this way, however.
|
|
| Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Mon May 23, 2016 4:24 pm Post subject: |
|
|
Mostly, projectile trajectory is calculated on the fly.
Assuming game has modern engine, like Unreal Engine, you can expect that for each arrow game will keep position (x,y,z), velocity vector (Vx,Vy,Vz) and acceleration vector (Ax,Ay,Az).
If game also takes aerodynamics into account, there will be additional factors.
https://en.wikipedia.org/wiki/Trajectory_of_a_projectile
_________________
|
|
| Back to top |
|
 |
hhhuut Grandmaster Cheater
Reputation: 6
Joined: 08 Feb 2015 Posts: 607
|
Posted: Mon May 23, 2016 4:25 pm Post subject: |
|
|
| Depending on the game you may also have to take the game's physics into your calculation ...
|
|
| Back to top |
|
 |
zm0d Master Cheater
Reputation: 7
Joined: 06 Nov 2013 Posts: 423
|
Posted: Tue May 24, 2016 2:11 am Post subject: |
|
|
| mgr.inz.Player wrote: | | projectile trajectory |
Thanks, that keyword helps.
| mgr.inz.Player wrote: | | position (x,y,z), velocity vector (Vx,Vy,Vz) and acceleration vector (Ax,Ay,Az) |
I found this vectors already. Now my brain stucks... How do I transform this data to a prediction line. I know I need stuff like a W2S method. But how is the data, I need to draw the line, presented? The game needs to calculate the flying route of the object, too. Isn't there a "simple" list of 3D-Vectors containing all locations the object passes? So I would call the W2S function for each element in this list, draw a point on screen and my line sums up? I guess I think to easy.
|
|
| Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4709
|
Posted: Tue May 24, 2016 8:58 am Post subject: |
|
|
| Quote: | | The game needs to calculate the flying route of the object, too. |
No it doesn't. The only thing it needs to do is calculate where the object should be in the next frame. I doubt it's deterministic to the extent you believe it to be.
Assuming the acceleration is constant, you can use basic kinematics to predict exactly where it's going. Use Google to learn.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
| Back to top |
|
 |
zm0d Master Cheater
Reputation: 7
Joined: 06 Nov 2013 Posts: 423
|
Posted: Tue May 31, 2016 8:58 am Post subject: |
|
|
I also could use the games projectile trajectory function, or?
I guess I would need to use the games projectile trajectory function, because of collision/rebound from walls?
I would have to add a time factor to the projectile trajectory function, or? I mean it's not very helpful to know, where my projectile is in the next frame. It would be more useful to know, where it is in the e.g. 5 next seconds.
|
|
| Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4709
|
Posted: Tue May 31, 2016 9:24 am Post subject: |
|
|
Unless the game literally displays a prediction line for you to see, you have no basis to assume the game knows exactly where the projectile is going more than a frame or two in advance.
Take pong as a very basic example. The computer can't easily predict human movements- the ball could bounce off the paddle or it could go right past it if the paddle isn't in the way. Thus, it's impossible for the computer to predict where the ball will be many, many frames in advance of where it is now (I'm not going to take into account Schrödinger's cat; it would only play with the ball). However, the computer can predict where the ball will be in the next frame quite nicely, as it can check to see if the paddle is in the way right now.
If the system you're talking about is completely deterministic, free of any randomness or outside interference, then you can calculate where the projectile will be many seconds in advance. I'd guess most games don't take into account air resistance and simply use a quadratic equation as a basis for projectile motion calculations. Since the game likely calculates it every frame, you should loop through whatever equation(s) the game uses for projectile motion however many times you need to calculate it however many frames in advance you need it. Finding that subroutine might be hard, and it's usually viable to guess what the constants are and make your own through trial and error.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|