Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: AncAinu on September 15, 2021, 06:47:15 AM

Title: [SOLVED] Top down shooter, turret to aim at mouse
Post by: AncAinu on September 15, 2021, 06:47:15 AM
I am trying something simple, have a turret follow (if possible smoothly) the mouse pointer on a top-down 2d view.

And despite all my attempts and watching tutorials, I can't figure it out.

Any help appreciated
Title: Re: Top down shooter, turret to aim at mouse
Post by: RapperCerberus on September 15, 2021, 10:11:22 PM
I'll do that like this:
Use <get mouse X> and <get mouse Y>to get the position of mouse cursor on screen.
Use <screen to world point> to change mouse cursor's screen position to world position.
And then use <set position> to set an object to the mouse cursor's world position.
Last step, use <smooth look at> to let turret look at the object all the time.

Notice: every step need to be <every frame> turn-on. Hope this can help you.
Title: Re: Top down shooter, turret to aim at mouse
Post by: AncAinu on September 17, 2021, 08:51:05 AM
Yes that worked thank you so much!
Title: Re: [SOLVED] Top down shooter, turret to aim at mouse
Post by: RapperCerberus on October 14, 2021, 01:32:47 AM
np:)    glad I can help