Air Hockey Game mallet controlled by mouse movement

Hello Everyone!

I am trying to make an Air Hockey game and am having a difficult time with blueprints.

What I am trying to do is have the mallet attached to mouse movement. So far when I try the attached blueprint set up the mallet disappears. I can see that the mouse location is being updated but for the life of me I can’t figure out why the mallet doesn’t show up.

I used this post a reference. Whiteboard Blueprint - Game Development - Unreal Engine Forums

Any help would be great.

Thank you!

Hi Maj,

There’s two issues I see with your blueprint code.

  • First, the “World Direction” value from “Convert Mouse Location” node is a vector with angular data with values less than 1. So, what you want to do instead, to determine the end point of your trace, is to multiply the direction by an arbitrary value (the length of the ray trace you want - I used 800 units in the image below) and add that value to your starting position:

  • Second, is that you should only set the actor’s location if the trace was successful. This can be accomplished by adding a branch from the return value on the trace:

AWESOME! Thank you schmit! Now I just need to figure out how to keep the mallet on the table, set the movement area and limit the movement speed. This has been bothering me for days!