XaiJu
CodeLikeMe
CodeLikeMe

patreon


Unreal Engine C++ #3 - Target Spot Lights

In this episode of unreal engine C++ tutorial series, I am going to change implement a darker stage arena for the characters to fight and in this arena, there are spotlights which keep pointed to the player and enemy characters as they move around the arena. I am going to implement these target light actors with C++.  

Basically you will learn here,  

how to reference an external actor object in the level and how to find the rotation the the light should face using FindLookAtRotation defined in KismetMath library. The rotation calculation operation will take place in a private function and this function will be called in 2 places. First, in OnConstruction() function and second in tick().   

The OnConstruction function will be called whenever the actor is placed, moved or property changed similar to the construction script in blueprints. We can use this to keep the light targeted towards the target actor in the editor before game is played by setting the actor rotation as calculated in above mentioned function.

password=codelikemecpp_targetlights

Unreal Engine C++ #3 - Target Spot Lights

More Creators