[SOLVED] Mouse Rotation?

Adder

  • Posts: 37
Is there a way to rotate an actor so that it is always pointing toward the mouse cursor?

« Last Edit: October 17, 2018, 09:29:01 pm by Adder »
Hiss hiss

ariakbari

  • Posts: 43
I believe it is -

set (x) to (X of mouse) - (X-center of self)
set (y) to (Y of mouse) - (Y-center of self)
set (direction) to atan2 y: (y) x: (x) as degrees
point self towards (direction) degrees

x, y, and direction all being number attributes

Adder

  • Posts: 37
I believe it is -

set (x) to (X of mouse) - (X-center of self)
set (y) to (Y of mouse) - (Y-center of self)
set (direction) to atan2 y: (y) x: (x) as degrees
point self towards (direction) degrees

x, y, and direction all being number attributes
Thanks
Hiss hiss

JeffreyDriver

  • Posts: 2262
There's also the Easy Math extension that includes lots of useful blocks to simplify things like this.