Documentation

__ Advanced Laser System

Documentation

__ Advanced Laser System

Getting Started


1- Setup your project 

This section is used to set up a default configuration for the LaserComponent.

1.1 - Edit your project settings

In Project Settings > Engine > Collision



Create a custom Trace Channel and name it "Lasers." It is not mandatory but recommended to avoid conflicts with other trace channels in your project.

1.2 - Edit LaserComponent 

In Content > AdvancedLaserSystem > Blueprints > SC_LaserComponent
Then, click on Class Defaults and navigate to Laser System > Settings and configure the trace channel with the one you just created.

1.3 - Setup the name of your Niagara parameters
Always in Class Defaults and Laser System in Niagara Laser parameters



You can keep this parameters and use my Niagaras system in the Niagara folder. Or you can keep these parameters and create tour own niagara system

1.4 - Explanation of the parameters
- Required

  • Laser Start: Define the start of the Niagara Ribbon.
  • Laser End: Define the end of the Niagara Ribbon.

- Optionnal (If you use your own niagara system)

  • Laser Color: Define the color of the Niagara Ribbon.
  • Laser Width: Define the width of the Niagara Ribbon.
  • Laser Impact Normal: Define the orientation of the Impact Niagara.
  • Laser Show Impact: Allows you to display or not the impact of the laser.
  • Laser Power Start and Laser Power End: These are used to fade the laser when the laser is close to the maximum beam distance.

 

 

How to use

 

1 - Add the SC_LaserComponent

Don't forget, the laser's forward direction is along the X-axis.

2 - Setting up the appearance

3.1 - Change the laser settings

3.2 - Explanation of these parameters (These parameters are usefull for the next section)

  • Laser Name: It's the name of the laser. This way, you can differentiate lasers by their name.
  • Max Bounces: To enhance the performance of your project, you can limit the number of laser bounces.
  • Trace Channel: As in the first section, you have the option to change the trace channel for each laser if desired.
  • Should Apply Damage: If LaserHitOnTick is disabled, damage will only be applied on the first hit.
  • Damage to Apply: Determine the amount of damage the laser applies.
  • Laser Hit on Tick: If set to true, you can receive a hit trace on each tick.
  • Set Hit Interval: If Laser Hit On tick is set to true, you can specify the interval between each tick.
  • Auto Active: If set to true, the laser will be activated at creation.

4.1 - Niagara parameters

You can set these parameters for each laser, just like in the first section.

 4.2 - Reminder

- Required

  • Laser Start: Define the start of the Niagara Ribbon.
  • Laser End: Define the end of the Niagara Ribbon.

- Optionnal (If you use your own niagara system)

  • Laser Color: Define the color of the Niagara Ribbon.
  • Laser Width: Define the width of the Niagara Ribbon.
  • Laser Impact Normal: Define the orientation of the Impact Niagara.
  • Laser Show Impact: Allows you to display or not the impact of the laser.
  • Laser Power Start and Laser Power End: These are used to fade the laser when the laser is close to the maximum beam distance.

 

 

Communicating with lasers

 

1 - In the laser component you have access to two Events Dispatcher

1 - On Retrieved Laser Hit

With this Event Dispatcher, you can retrieve hit information on the surfaces hit. If you have set Laser Hit on Tick to true, this event will be called every tick.

2 - On Lost Laser Hit

With this Event Dispatcher, you will be notified if the hit is lost. 

Also, you have the Index Hit that you can use to differentiate between two hits on the same actor.

 

2 - Blueprint Interface BPI_LasersCommunication

1 - Event Received Laser Hit

In contrast to the event dispatcher, you can receive the hit of the laser. For example, you can activate something when the laser hits it. Additionally, you can activate something only if the laser has the correct Laser Name, Emitter, or Laser Component.

2 - Event Lost Laser Hit

You can also do the same as OnReceivedLaserHit when losing the hit.

 

Configure the surfaces

 

The surfaces can exhibit two behaviors: reflection or passthrough. To do this, you have to add a component Tag : Reflection or Passthrough (Not case-sensitive.)

1 - Reflection

The static mesh will reflect the laser as many times as the max bounces variable is configured.
You can retrieve each bounced hit.

2 - Passthrough
You have two options:

  • Either add the Passthrough tag
  • Set the Trace channel to overlap or ignore.

What is the difference ?

If you used the tag, you can retrieve the passthrough hit. 
If you used the overlap trace response, neither hit will be retrieved.

Glossary

1 - Enable

To enable the laser

2 - Set Actors to Ignore

You can specify to the laser which actors can be ignored by it.

3 - Enable and Set Actors to Ignore
This function merges the two previous ones.

4 - Set Laser Name
You can set the name of the laser with this function.

5 - If Damage Caused By Laser

This macro is usefull for the Event AnyDamage to define if the damage causer is a LaserComponent


 

Use it like so:

 

 

Multiplayer

If you want to use this component in multiplayer, you have to call the Enable function on the server

Don't forget to check Replicates on the owner