All Questions


Akbar Hashimi

velocity = speed * direction

I noticed you multiplied two vector 2D variables 'speed' and 'direction'.  Is this a dot product multiplication?

  • Nathan Lovato replied

    No, dot product is a different operation, often used to indirectly compare angles between vectors.

    You'd write it like so:

    Instead, speed * direction is a per-member multiplication. It's equivalent to:

    Vector2(speed.x * direction.x, speed.y * direction.y)