I know this might be a dum question…

But how do make an arrow continuously rotate towards a moving object, or a mouse?

I know this might be a dum question…

But how do make an arrow continuously rotate towards a moving object, or a mouse?

Hi @Hamzah_Al_Ani!

Here’s a project with an arrow pointing to the mouse:

PointToMouse5-18-2020_10-23-42AM.wick (2.2 KB)

I used the Math.atan2(y, x) function which calculates the rotation angle from the difference in location (the arctangent). atan2 gives the answer in radians but Wick uses degrees, so I multiplied it by 180 / pi to convert. Here’s the important line of code:

this.rotation = -Math.atan2(this.x - mouseX, this.y - mouseY) * 180 / Math.PI;

Let me know if you have any questions!

1 Like

I was trying to do the exact same thing, but my trig is trash. if it weren’t for me giving up I would have spent like half an hour doing something that someone already did.

stay safe y’all

1 Like