Ray Trace Parameters and Components


Author: Matthew Pacheco

We completed the system build this week. I worked on the defenses, primarily the turrets. In order for the turrets to stay locked onto the enemies, they had to have an overlap. I did this with a ray traced sphere which required a Trace parameter and a Collision parameter. These were the cause of my first issue. Most of my issues came up when trying to set these to the correct values. I first attempted to use the default collision channels, but they always led to unexpected results, a lot of meshes and objects I didnt expect like the floor. To fix this, I created a new channel for enemies that was set to ignore by default. Setting my ray traces to this in the various functions that required one, allowed me to only interact with the enemies. 

My second issue was caused by the way I was trying to capture the different static mesh components. Since the turret was made up of 4 different meshes, and only 2 were required to shoot/1 required to move, I had to have references to these in order to call them in different functions. My initial idea for this was to use GetComponents<UStaticMeshComponent>(); but the results given by this were not consistent between instances, and so the references would be mixed up. To fix this issue, the variables had to be exposed to blueprint and tied to the proper static mesh. 

These two issues were the most notable ones, but were easy fixes to implement once figured out. These fixes should also be useful going forward as there may be more times I have to set custom collisions for ray traces or store references to specific components repeatedly.

Posted on: 10/13/23

Get Cyber Siege

Leave a comment

Log in with itch.io to leave a comment.