User Tag List

Results 1 to 1 of 1

Thread: Projecting Vectors to the Axis

  1. #1
    Here lies mero. Died by his own dumbassitude.
    Join Date
    May 2011
    Posts
    929
    Mentioned
    102 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    5,527
    Level
    23
    vBActivity - Bars
    Lv. Percent
    13.96%

    Projecting Vectors to the Axis

    Okay so I'm trying to figure out how to make a enemy move in a parabola along the Z axis while moving along x and y in a a straight lineon the other Axis.
    In otherwords it swoops down from variables x and y too a and b (the midpoint of the line) and fires then swoops back up until it reaches endx and endy.
    The problem I'm having is Projecting the vector to the X axis.

    void Swoop(ffc this, npc ghost, bool numSweeps)
    {
    float a=Link->X;
    float b=Link->Y;
    float x=Ghost_X;
    float y=Ghost_Y;
    float endx=GetEndX(x);
    float endy=GetEndY(y);
    float angle=Angle(x,y,endx,endy); //Axis Angle
    int counter=0;

    //Descend
    while(counter<TBIRD_SWEEP_TIME && Ghost_HP>0)
    {
    counter++;
    Ghost_X=SmoothStep(x,a,counter/TBIRD_SWEEP_TIME);
    Ghost_Y=SmoothStep(y,b,counter/TBIRD_SWEEP_TIME);
    //Vector Projection

    TBird_Waitframe(this,ghost);
    }

    //Fire
    if(numSweeps==1 && (ghost->Attributes[TBIRD_ATTRIBUTES_FLAGS] & TBIRD_NO_SBOLT)==0)
    SBolt(this, ghost);
    else
    Fire(this, ghost);

    //Ascend
    }

  2. #2
    Octorok Asuna Yuuki Nagato's Avatar
    Join Date
    Jan 2024
    Posts
    486
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    32
    Level
    2
    vBActivity - Bars
    Lv. Percent
    19.17%
    The vector dot product is your friend.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social