playMaker

Author Topic: [SOLVED] Top down shooter, turret to aim at mouse  (Read 216 times)

AncAinu

  • Playmaker Newbie
  • *
  • Posts: 2
    • View Profile
[SOLVED] Top down shooter, turret to aim at mouse
« 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
« Last Edit: September 17, 2021, 08:51:44 AM by AncAinu »

RapperCerberus

  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Re: Top down shooter, turret to aim at mouse
« Reply #1 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.

AncAinu

  • Playmaker Newbie
  • *
  • Posts: 2
    • View Profile
Re: Top down shooter, turret to aim at mouse
« Reply #2 on: September 17, 2021, 08:51:05 AM »
Yes that worked thank you so much!

RapperCerberus

  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Re: [SOLVED] Top down shooter, turret to aim at mouse
« Reply #3 on: October 14, 2021, 01:32:47 AM »
np:)    glad I can help