Announcement

Collapse
No announcement yet.

Twin stick shooter template: shoot at mouse?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Twin stick shooter template: shoot at mouse?

    I'm just making the jump over to Unreal from Unity — and, admittedly, I wasn't very good at that yet either — specifically* for the blueprint system. (I've lost my ability to type code due to a worsening disability, and dictating code is downright painful.)

    Anyway, I thought I would teach myself blueprints by making a simple shmup that I am physically able to play. Of course, very first thing I tried to do I hit a roadblock.

    I thought I had figured out the logic. The template already calculates a vector from the stick axes, I thought I would just insert a new vector by taking the mouse position on screen, converted to world space, then calculate a vector towards it. But, it doesn't seem to work. It just fires very slow projectiles in a downward direction with only slight variance in vector. (I'm guessing the slow part has to do with the z vector, but the rest I can't figure out.)

    *I did also fall in love with the level design tools once I found out about them.

    #2
    The node you are looking for is called "Get Hit Result Under Cursor by Channel", it outputs the location of the cursor in world space. Then use your starting point (muzzle) and add the cursor hit result location, and you will shoot into the mouse direction.

    Comment


      #3
      Click image for larger version  Name:	LookAtMouseLocation.jpg Views:	1 Size:	207.8 KB ID:	1562127
      This is how I'm doing it.. Whoops, I just noticed I didnt capture it, but after this, I use a Find Look At Rotation from actor to target, and set the actor rotation. The set target rotation in the top left is my gamepad support.
      https://www.patreon.com/MMaxwell
      https://twitter.com/Michael25991355

      Comment

      Working...
      X