Vector Primitive (Construct 3 Plugins)

You're viewing a single comment in a conversation. View all the comments
  • 3 Comments

  • Order by
  • Can this be used to see how much a rotating sprite is facing a position?

    • You can do that by just using the angle() system expression

      • I did not clarify what I meant. My mistake.

        Angle() returns the angle between two points and does not factor in their facing angles. What I needed is to know how much object A is looking at point b. regardless of point B's facing or their angle to each other.

        I was able to get what I needed though.

        -> System: Set facingX to cos(myAngle)

        -> System: Set facingY to sin(myAngle)

        -> System: Set toTargetX to (inputTargetX - myX) ÷ distance(myX, myY, inputTargetX, inputTargetY)

        -> System: Set toTargetY to (inputTargetY - myY) ÷ distance(myX, myY, inputTargetX, inputTargetY)

        -> System: Set dot to (FacingX × ToTargetX) + (FacingY × ToTargetY)