Page 2 of 2
Posted: Sun Apr 12, 2009 3:57 pm
in case you couldn't find this from the program, i have found that in a perfectly circular arc the distance traveled will be r * 2θ * sin(90 - θ) / sin(2θ) or 2θ * (r/2) / cos(90 - θ) where r is the distance between mouse and ship and θ is in radians. these values are radius of curvature times angle in radians. you will just have to cap this value or something so they cannot accelerate more than the ship is capable of.
reverse as in flying backwards? that's negative velocity, but basically the same calculations but done on the other side of the ship. this is when the θ i'm talking about is greater than 90, and the ship's acceleration is great enough to bring its current velocity below zero. otherwise, i'm not quite sure what you mean.
Posted: Sun Apr 12, 2009 6:07 pm
Sorry, but I'm really confused now.
You're saying I don't even need to know P1 or worry about B?ziers any more?
Distance Travelled = 2θ * (r/2) / cos(90 - (θ * 57.2958))
* r = distance from ship to mouse
* θ = what is this angle?
I multiplied by 57 because I need everything in degrees (my software doesn't do radians, and nor do I really).
So to get Speed, I just divide that by the number of frames per turn.
What about turning though? I still need to know how many degrees to rotate per frame.
Posted: Sun Apr 12, 2009 7:43 pm
well, don't you need B?ziers for the arc approximations? the distance i gave is the exact total distance the ship would travel in a circular arc, and the total rotation is 2θ. θ is the angle between the line the ship travels in if there is no turn and the line between mouse and ship. for example, if your ship is moving upwards and your mouse is directly to the right. θ=90 degrees, and this corresponds with a 180 degree turn, which makes sense, as you will travel in a half circle.
i am by no means experienced in programming games and have almost no knowledge on graphical stuff, but i can tell you that you can divide this 2θ by the number of frames to get the amount the ship will rotate each frame.
Posted: Sun Apr 12, 2009 8:04 pm
(On a side note, shouldn't this be in the "Programming" part of the forum?)
Posted: Sun Apr 12, 2009 11:59 pm
Something's definitely not right - it's coming up with a curve length much, much too high at the moment - even without multiplying the angles by 57.
Now you've pointed out that there's no acceleration, and that the arc is infact just part of a circle, I think I should be able to figure it out though.
I have something that works for one quadrant now (forwards, while turning left). It looks like the other 3 quadrants will need to be catered for separately, which is a bit annoying, but hopefully not too problematic - just need to change a few signs around, I expect.
Thanks again for the help.
And yes, it probably should have been in the programming section, but noone reads that section, and who really cares anyway
Incase anyone's curious, I'm intending to make a multiplayer-only game, somewhat similar to Critical Mass. Actually, it'll probably be more like FlightCommander2 or OverTheReich in most respects, but using CriticalMass's more intuitive movement system.
Posted: Tue Apr 14, 2009 2:06 am
o crap, the stuff i posted earlier was a bit wrong. the 90s in the trig functions are 90 degrees. but yeah, good luck on that.
Posted: Tue Apr 14, 2009 12:18 pm
The system I've got now is almost working - it's perfect when you want to move forward, but I haven't got reverse working yet (sure I will though).
You pointing out that the acceleration is instant, and that the curve is constant radius, was a *huge* help
Basically, it's like this:
* Find difference in angle between original heading and angle to mouse.
* Take this away from 90 (the centre of the circle is at a 90 degree angle from the original heading). This gives one of the interior angles of triangle: StartPoint->Mouse->CenterOfCircle
* One of the other interior angles is the same as this, and since all angles of a triangle must add up to 180 degrees, we can find the other. This gives the total rotation during the turn.
* Use triangulation to find the shortest side of a right angle triangle (our previous triangle split in two).
* One of the other sides is known as half the distance from start point to mouse, so use pythagoras' theorum to find longest side, which = radius of circle.
* Calculate circumference of circle from radius. Divide this by 360, and multiply by the total angle rotated = length of arc travelled.
Is that the way you did it too?
Thanks again for your help
Posted: Wed Apr 15, 2009 1:08 am
yeah, that's pretty much what i did, except it's not the pythagorean theorem but basic trigonometry (or alternatively law of sines), and i was half thinking in radians and half in degrees, as if you use radians you don't have to calculate circumference, divide by 360 and multiply by that angle, just angle in radians times radius, but since you're using degrees talking about radians will just make things more complicated for you.
one possible method to making the ship reverse is that whenever the angle the mouse makes with the line of movement of the ship is over 90 degrees and the ship can accelerate its velocity to below 0, treat the ship (i.e. the movement calculations) as if it is facing and moving backwards.
Posted: Sat Jan 22, 2011 11:41 am
I'm pretty sure a modern AAM couldn't out-turn something like an F-16, but it can fly at Mach4+ so it doesn't need to.
It does need to and it can. Rule of thumb, to hit something you need three times its acceleration. So if the F-16 can pull, say, 8 g then the missile wants 25 g.
Missiles can pull more acceleration when they are moving quickly. So at the edge of their range they become easier to dodge.
The first AAMs didn't lead their targets, just like Critical Mass missiles, that changed in the late 1950s. You may find this interesting:
http://en.wikipedia.org/wiki/AIM-9_Side ... troduction
Posted: Sun Jan 23, 2011 7:22 pm
I think you're getting confused...
Pulling higher G is totally different from out-turning something.
The actual turning circle of a missile is *much* greater than that of an aircraft.
Here's the maths, done by someone on another forum:
AIM-9X maxes at 50 G (which is probably in the boost phase with thrust vectoring). Let's assume that at the critical moment the missile is doing 40 G and 680 m/s (M2 sea level).
Aircraft is doing say, 2 G and 55 m/s (200 km/h).
r = v^2/a so the ratio of R-aircraft to R-missile is (55^2/2)/(680^2/40) or 1512.5/11560 or 13%. So the aircraft is capable of generating a turning circle 13% the radius of the missile. In space the aircraft is much more maneuverable.
Posted: Fri Jan 28, 2011 10:44 pm
While I agree with the point about missiles vs airplanes and the maths obviously reasons it, I am slightly piqued about the final sentence. In space the aircraft is much more maneuverable? Where does that come from?
Posted: Fri Jan 28, 2011 11:35 pm
He means space as in "3d-space" (ie. as opposed to talking about maneuverability in terms of lateral acceleration).
He's not talking about space as in outer-space, aliens, etc - if that's what you're thinking...