No announcement yet.

How To Spline A Beam From Tracing Weapon?

  • Filter
  • Time
  • Show
Clear All
new posts

    How To Spline A Beam From Tracing Weapon?

    I wish to create a beam weapon that splines the beam when attaching to a target within range. My current blueprint attaches to a character but does not spline.
    What is the blueprint component that will allow me to spline the beam? (tangents?)

    I also have not discovered how to specify the max curve before detaching.

    An exact example of what I want is in this video [here]

    My current blueprint setup has the weapon actor as a separate blueprint from the beam actor.
    Attached Files

    Wanted to provide the answer I created. Use a Cable Component to act as the beam.

    On a successful line trace the hit actor is stored as the Line Gun Target variable. Add Cable Compoent on successful hit. Within that Add Cable Component box set gravity to zero. Set Material changes the color of the cable. Set World Location and make the Target the return node from Add Cable Component; this will attach the other end of the cable to the hit actor. Cable Length is unnecessary but it makes the bending smoother when not adding more cable segments. Set Cable Force to the forward vector of the player pawn and multiply it by a lot to make the beam bend with the camera forward vector (remember to set the cable gravity to zero to bend effectively with the camera movements). Eventually this script will need to repeat on itself so the beam target location is constantly updated to give the illusion that it is attached to the hit actor. I put in the "? IsValid" checks to see if the Hit Actor is still the target of the most recent line trace. In the event the Hit Actor is destroyed or whatever, the "? IsValid" will come back false and destroy the Cable Component make it look like the beam disappeared and to save rendering demand.
    Last edited by Xnar; 07-08-2017, 12:05 AM.


      Thank you. Just what I was looking for.
      Developing new casino games here: