playMaker

Author Topic: Forward velocity in 2d  (Read 330 times)

Kalerion

  • Playmaker Newbie
  • *
  • Posts: 1
    • View Profile
Forward velocity in 2d
« on: September 26, 2019, 12:09:13 PM »
My player creates "bullet" objects which are supposed to move towards a point and beyond it with a set speed.

I created the object and adjusted its rotation but I can't find a nice way to make it move towards this point with a set speed/velocity.

In this example: Playerobject creates a bullet when mouse down which flies towards the mouse until it hits something or is out of the camera. I just can't manage to get the "movement" part right due to "Set Velocity 2d" having to specifiy a point

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 633
    • View Profile
Re: Forward velocity in 2d
« Reply #1 on: September 30, 2019, 06:25:50 AM »
Looks like the "point" you need to target should be related to the position of your mouse's cursor. I suspect you're doing a top-down manic pedestrian shooter where you control the shooter with keys and the direction of the projectiles with where your mouse is.

You must tell Playmaker/your game where the cursor is in your scene or screen view with a raycast of some sort.
Then, either directly use the coordinates or use a gizmo that automatically sticks to the projected cursor's coordinates and use that gizmo Game Object as a target.