How to cast to the location of a separate Actor on an input event?

Aye. This is often critical when you simulate physics. Think about it:

If you apply an impulse, the box would fly away but it moved in the relative space of that actor. When you now ask the engine where that actor is - it’s still where the arrow is pointing. It did not move from where it was spawned.

But if you make the box the root - as you did - now the whole actor is tumbling away and its world location is the same as the location of the box. Technically, you could do this instead:


But if 1 coin = 1 actor, making the root the simulating element makes perfect sense.

Thanks again for all the help!

One final thing, I decided to draw a debug line constantly to the Last Coin Thrown, as having a line between the player and the coin (or an arrow really) is super helpful for using the system.

Is there any way to draw a debug-like arrow that will actually show up when the game is moved outside of the editor? From what I can see, debug lines only show in the editor when playing.

Spline + Spline Mesh Component. Or ribbon particle (orwhatshername) in Niagara.

Check here:

And here:

You can also draw lines with widgets, and the HUD class does it well, too. Plenty of options, actually. Even the materials can draw 2d / 3d splines - but there’s an upfront cost to setting it up.

outside of the editor

So a shipped product or… ?

Trying to do that spline mesh thing, looked at your explanation on the first thread there. Tried to get it to work with what I’m doing but when I hit play nothing shows. What am I doing wrong?

EDIT: Hmm okay so actually I just was drawing the spline mesh too small, but I’ve gotta say it now looks pretty dooky. How should I go about making the spline mesh around the same size and color and such as the debug line?

Something about this doesn’t look exactly right lol I can get the shape looking nicer but the main issue is that the spline doesn’t actually begin at the player and end at the coin, it seems just slightly offset from them both?

The coin lives in world space but the spline is set to Local. Explore the rest of the thread I linked, it addresses this very issue - the one with the red laser.

I’ve gotta say it now looks pretty dooky.

But perhaps simple lines are needed instead, draw it with the HUD:

  • in the HUD class

– send HUD an array of points and player screen position
– during HUD update, draw those lines and an icons
– draw an icon on each target
there are more draw options, explore

  • player gathers data and send it to the HUD:

– the above finds all coins within the radius of the sphere, result:

Zipped project:

Have a look and test it out - see if you can get the line to look the way you need. Sadly, these are aliased. For anti-aliased, you could use widget’s onPaint - create a full screen canvas and have the widget connect the points.

In case there was doubt regarding how to do it with widgets, the project linked above has been updated and you can switch between the 2 - see what fits you best:

Above, the antii-aliased lines look superior, ofc. A neat trick is to draw 2 lines, one on top of the other; the 1st one is thick and the 2nd one is thin:


If you make the inner, 2nd line brighter, the whole thing will have more body / volume.