Post

Game Kit: Laser System (C++)

A C++ based laser system with Niagara.

Game Kit: Laser System (C++)

Laser System


Screenshots:


Fully customizable Laser System


  • Implemented in both C++ and BP.

  • Beam and impact effects are created in Niagara. You can create your new beam and impact and easily integrate it into the system.

  • Laser beams can be reflected from mirror material and also can be used as triggers.

How-To


You have to create a new trace channel for laser.

Edit -> Project Settings -> Collision

You can create a new trace channel for the laser in the Collision panel as shown in the image below.


This section is for those who get the C++ package

These settings are saved in DefaultEngine.ini under CollisionProfile section.

You need to find out to which GameTraceChannel is set to LineTrace. In my case it is set to ECC_GameTraceChannel1.

1
2
  [/Script/Engine.CollisionProfile]
  +DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,DefaultResponse=ECR_Block,bTraceType=True,bStaticObject=False,Name="LaserTrace")

Finally, replace the value on line 16 of LaserEmitter.h with yours.

1
  static ECollisionChannel ECC_LaserTrace	= ECollisionChannel::ECC_GameTraceChannel1;

And that’s it…

You can add the BP_LaserEmitter actor to the scene and can set its parameters as you like.

This post is licensed under CC BY 4.0 by the author.