Announcement

Collapse
No announcement yet.

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

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

    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!Click image for larger version

Name:	Untitled.png
Views:	98
Size:	213.8 KB
ID:	1708809

    #2
    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:


    Click image for larger version

Name:	cannon.jpg
Views:	69
Size:	147.4 KB
ID:	1708922





    Comment


      #3
      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!



      Attached Files
      Last edited by FunAndFriendly; 01-15-2020, 11:12 AM.

      Comment


        #4
        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,

        Click image for larger version

Name:	cannon2.jpg
Views:	51
Size:	84.0 KB
ID:	1709125

        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.

        Comment


          #5
          Hey Basement Bob thank you!

          Comment

          Working...
          X