A_Tracer's turning radius
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
A_Tracer's turning radius
What's the turning radius (as it would be with A_SeekerMissile's parameters) of A_Tracer? It's not on the wiki page.
Re: A_Tracer's turning radius
24 hours later. Checked the source, and it's so far over my head, I can't tell what it is from there. 
Re: A_Tracer's turning radius
Well. It could use some constants instead of hardcoded values, for consistency and to limit problems if the constants were ever changed for whatever reason.
However:
Is it any clearer now?
However:
Code: Select all
// change angle
exact = R_PointToAngle2 (self->x, self->y, dest->x, dest->y);
if (exact != self->angle)
{
if (exact - self->angle > 0x80000000) // 0x80000000 == ANGLE_180
{
self->angle -= TRACEANGLE; // TRACEANGLE == 0xc0000000 == ANGLE_270
if (exact - self->angle < 0x80000000)
self->angle = exact;
}
else
{
self->angle += TRACEANGLE;
if (exact - self->angle > 0x80000000)
self->angle = exact;
}
}
Re: A_Tracer's turning radius
Nope. Saw that exact piece while rummaging around, and realized that was exactly what I was looking for, but couldn't make heads nor tails of it.Gez wrote:Is it any clearer now?
Which isn't really surprising, since I haven't really tried to learn C, yet.
Re: A_Tracer's turning radius
If the angle to the target is not the current angle:
* If the difference is greater than 180°, subtract up to 270° from the current angle, in order to match the angle to the target.
* Else, add up to 270° to the current angle, in order to match the angle to the target.
However, this affects only the angle it is now targeting. Then the momentum is affected by multiplying its speed (that's 10 for the revenant tracers) by the new angle's sine and cosine for the Y and X axes of movement respectively. At this point, it's maths, not code.
So, you don't have really an explicit radius, but you have a maximum turning angle (270°) and a formula to compute it.
* If the difference is greater than 180°, subtract up to 270° from the current angle, in order to match the angle to the target.
* Else, add up to 270° to the current angle, in order to match the angle to the target.
However, this affects only the angle it is now targeting. Then the momentum is affected by multiplying its speed (that's 10 for the revenant tracers) by the new angle's sine and cosine for the Y and X axes of movement respectively. At this point, it's maths, not code.
So, you don't have really an explicit radius, but you have a maximum turning angle (270°) and a formula to compute it.
Re: A_Tracer's turning radius
Ah. So it's not possible to completely replicate A_Tracer homing aggression with A_SeekerMissile?
Re: A_Tracer's turning radius
Well, given you're limited to a 90° angle in [wiki]A_SeekerMissile[/wiki] and tracer's values are 180 and 270... Otherwise it would be just that: A_SeekerMissile(180, 270).
- bagheadspidey
- Posts: 1490
- Joined: Sat Oct 20, 2007 10:31 pm
- Contact:
Re: A_Tracer's turning radius
Fix A_SeekerMissile gez ;)
