Announcement

Collapse
No announcement yet.

Attach actor to mouse cursor, with offset

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

    Attach actor to mouse cursor, with offset

    I've posted this on the answer hub without any feedback, so moving to here to see if I get better luck.

    (https://answers.unrealengine.com/que...se-cursor.html)

    In my basic wac-a-mole game, I have a mallet which I want to follow the mouse cursor around the play area. The mallet needs to be slightly offset in the Z. When I click the mouse, the mallet wac's the mole.

    The mallet in my current implementation does move a little bit with the mouse, but no where near where I need it to be. It is like the movement scale needs to increase, or I've approached this incorrectly.

    In my game image, the mouse cursor is on the far left of the screen, but the mallet has only moved a fraction in the correct direction.

    What I am doing wrong?




    #2
    I'd say toss a Vector * Float node between your "Make Vector" and "Make Transform". Getting the multiplier value correct will be tricky, I'd start with 20 or so.

    If you're looking for a more elegant solution.. sorry, I don't have one.

    Comment


      #3
      your mouse is moving on a plane, your hammer is moving on another. so what you need is a projection(usually involving normalized your source and then project to your target, like rendering does). this would allow you to do arbitrary level/camera combination as well.

      now, probably doing it involves doing math with transformation nodes, but UE4 did most of that for you for the mouse to screen part. what you now have to do is have 2 3d vector widget for your blueprint to define the top left and bottom right corner of your table. the rest in just simple linear remapping.
      Unreal Engine 4 Game Framework diagram for relation of all major base object types
      Unreal Engine 4 Input Event diagram, scroll down to section Input Processing Procedural
      Resident Evil Classic Camera
      RPCs official document, Must Read
      Everything you should know about replication

      Comment


        #4
        thanks guys, as a complete beginner. I'm not really sure where to start with that. I might return to this project when I understand what was just said a little better.

        Comment

        Working...
        X