Wadimiss? Calculate vector between two locations. Re-position component.

Hey there, I’m learning the blueprints and trying to launch this cannon ball (sphere) from Start Location to End Location when the Pawn overlaps a trigger volume.

When the pawn leaves, I want to move it back to the start (floating in the air).

What did I miss? The ball flys off 90` from the direction I expected, Force Multiplier is 20k (which seems a tad extreme) and I can’t figure out where it’s resetting to when the Pawn ends the overlap. Start/End are in local coordinates.

Thanks in advance!

Use Add Impulse,
place tick in MassInKg , set it to 10,
Test with impulse of 10,000 in Z… nothing in x or y, if it works, try this:

Thank you! Here’s where it ended up.

It’s a test jig for the target cube. When the pawn gets close, it turns on “targeting” (BP not shown), then closer to fire the red ball. This Blueprint handles the launch and reset. StartLocation and EndLocation are 3d widgets on the Blueprint.

  • Is there a simpler version of the foo before GetUnitDirection(Vector)?
  • Also, why does the SetRelativeLocation only put the ball back when StartLocation (0,0,0) has been transformed to World coordinates?

Here’s the “working” version and a video. I’m learning the C++ and the BP, and it’s so much easier to communicate about the BP code. Thank you!

Lot of different ways to get similar results, depends on the rest of your setup, for example if the whole actor turns or a component rotates all you need is the “forward vector” and no target at all,

cannon2.jpg

Regarding the need to use transform, this would indicate your start and ends are local offsets within the blueprint, and not world location, no idea why you are using those values, but if you do you will need the transform. The above works.

Hey [USER=“4519”]Basement Bob[/USER] thank you!