Welcome back.
In this video, we're going to fix a pesky issue that's been bothering me for the last couple videos.
And that's if I have my circle showing and I'm aiming for the enemy.
I get this weird, funky behavior because I'm tracing onto the enemy, and that's changing my impact
point on my hit result, and that's really bothering me at this point.
So I think we're going to fix it now.
See if you can figure out a way to easily fix this, maybe brainstorm a bit, pause if you like, and
see if you can figure out an idea.
And if you feel like that is a good idea, maybe give it a try.
What I'd like to do is I'd like to ignore enemies when I have a magic circle, when my magic circle
is valid and we're tracing in the player controller, I'm going to go ahead and close all tabs and open
Aura Player Controller and in Cursor Trace.
Here we're getting the hit result under the cursor and we're tracing against the visibility channel.
But we could trace against a different channel if our magic circle is valid if we have one.
Right.
So what I'd like to do is make a new collision channel that is basically like the visibility channel.
Everything blocks it except for a few things like enemies.
And perhaps this volume back here.
And Ora and Ora's box that fades pieces of the environment out.
So let's do that.
I'm going to go into project settings, and I'm going to search for objects so I can create a new collision
object channel.
I'm going to add this and I'm just going to call this exclude.
Players.
As in this game, players refers to both aura and enemies, but I'd like everything else to block it,
so its default response will be block and we'll accept that.
So now that we have exclude players, we can start making things ignore this trace type such as this
blocking volume here.
Now I'm not seeing exclude players, so I'm going to restart the editor.
And I'll go ahead and select this blocking volume here.
And now I see exclude players.
And I'm going to ignore that channel.
Now I'm also going to ignore it for our enemies so we don't hit them with the trace.
So I'm going to go into BP enemy base.
This is why it's very useful to have a base blueprint class, because we can set these properties here.
I'm going to set the capsule component to ignore exclude players.
And I'm going to do that for the mesh as well.
Ignore exclude players.
And while we're at it we'll go ahead and do this for the weapon.
The weapon can be custom and it will also ignore exclude players as well.
On top of that, we're going to need to take care of Ora Ora's capsule is going to ignore exclude players.
Or as mesh.
We'll also ignore it.
And Aura's weapon.
Will also ignore exclude players.
We'll set it to custom here.
Now, in addition to that, we also have this box.
This needs to ignore exclude players as well or we'll get some collisions with that.
So with that we should now see that our goblin here should be ignoring it.
So if we check its mesh, its mesh is ignoring exclude players as well.
So now that we have this collision channel we can use this in C plus plus.
So I'm going to save all those changes and go back into our player controller.
And I'm also going to open Orosz.
So we can have a macro symbol for our new collision channel.
It's going to be Game Trace channel three.
So I'm going to copy one of these lines, change it to Game Trace channel three.
And I'm going to call this exclude players.
Now we're going to use this.
Let's go into our player controller.
And what I'd like to do is make a const e collision channel.
Variable.
And I'm going to call this trace channel.
And I'm going to set it equal to the result of a ternary operator.
Checking is valid.
My magic circle.
So question mark here.
And if the magic circle is valid I'm going to trace against AEK exclude players.
And if our magic circle is not valid it's pending kill or null.
Then I'll trace against AEK visibility and then I can pass trace channel straight into git hit result
under mouse cursor.
And now we'll be tracing against two different channels based on whether or not we have a magic circle.
So with that.
Let's try this out.
All right.
So I don't need oral character or BP enemy base anymore.
And I can test this out.
I can get my circle, I can trace, and I don't hit my enemy.
If I go ahead and get rid of that circle.
Now, I don't have a circle anymore.
And I trace and I get the enemy.
So trace works with no circle.
Trace no longer works on enemies with the circle, but we're tracing against everything else, and that's
why we can still set that destination for our circle.
So that fixes that pesky problem.
And really we're going to be aiming at enemies, right?
So if we have a circle and we're looking to hurt some enemies, we're going to be aiming at them.
So we don't need that jerkiness that jumpiness they're distracting us.
And if you really wanted to highlight the enemies in red, well, you could do two traces.
While you have your circle active, you can do one that traces against the Exclude Players channel,
and then you can do another against visibility.
And you can use the exclude players one for your circle.
And then you could use the visibility trace for actually highlighting enemies.
So I'm going to give that to you as an optional challenge if that's what you want.
But I'm pretty happy with how this looks and how our gameplay mechanics are working.
And I really just like how this little oblivious goblin looks inside of this circle.
It's like looking around at the circle, like what's about to happen to me and or as like, well, this.
Excellent job.
I'll see you soon.