Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
ViolentBeetle

MBF21 - A_SeekTracer arguments

Question

Here's what specs for MBF21 tell me:

Quote

Args:

threshold (fixed): If angle to target is lower than this, missile will 'snap' directly to face the target

maxturnangle (fixed): Maximum angle a missile will turn towards the target if angle is above the threshold

So what exactly happens when the angle to target is between the two? I would assume it would also turn towards the target, but that would make threshold entirely meaningless.

Share this post


Link to post

3 answers to this question

Recommended Posts

  • 0
    dir = P_FaceMobj(actor, target, &delta);
    if (delta > thresh)
    {
        delta >>= 1;
        if (delta > turnMax)
        {
            delta = turnMax;
        }
    }
    if (dir)
    {                           // Turn clockwise
        actor->angle += delta;
    }
    else
    {                           // Turn counter clockwise
        actor->angle -= delta;
    }

"delta" is angle between actor and target, populated by P_FaceMobj. If delta is between thresh(hold) and turnMax, it is divided by 2 without remainder (delta >>= 1, a bitwise shift right), so it turns for half of the angle rather than the whole thing. If delta is less then thresh(hold), it turns to face target directly. And if it's too big, turnMax limits how much the turn can be.

 

Source is from dsda-doom p_mobj.c

Share this post


Link to post
  • 0
6 minutes ago, Doomy__Doom said:

    dir = P_FaceMobj(actor, target, &delta);
    if (delta > thresh)
    {
        delta >>= 1;
        if (delta > turnMax)
        {
            delta = turnMax;
        }
    }
    if (dir)
    {                           // Turn clockwise
        actor->angle += delta;
    }
    else
    {                           // Turn counter clockwise
        actor->angle -= delta;
    }

"delta" is angle between actor and target, populated by P_FaceMobj. If delta is between thresh(hold) and turnMax, it is divided by 2 without remainder (delta >>= 1, a bitwise shift right), so it turns for half of the angle rather than the whole thing. If delta is less then thresh(hold), it turns to face target directly. And if it's too big, turnMax limits how much the turn can be.

 

Source is from dsda-doom p_mobj.c

So it actually turn asymptotically, until it hits the threshold?

Share this post


Link to post
  • 0

Pretty much, it turns slowly until the angle is "small enough". If that small enough happens to be big, like say 30 degrees, you should get a very snappy projectile as a result.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×