BTD For seeing player without line trace by channel

Hello!

So i followed a tutorial for ai and they used line trace by channel to see the player as a target

I want to use the line trace by channel to deal damage to the player with the melee and shooting enemy, but changing the collision of the player to block then the shooting enemy thinks he cant see me at all and runs trying to find a way to see me

any idea of alternatives?

i tried the other line traces and it just had the same effect

Hey @FREAKINGREXIS!

It could be because you have your “Player Seeking” and your “Player attack” on the same branch instead of separate ones- BUT…

I’m thinking it has something to do with changing the collision of the player. Can you elaborate on that? What do you mean by “changing the collision of the player to block”? To block what? If you change their collision profile to something that does not block visibility, you WILL NOT get the line trace to find them, that may be your issue!

Linetracing is the best method of going about this, as it is basically the only way to find out if there is line of sight between two actors.

Hope that helps! :slight_smile:

Thank you so much!

So it was that the player character did not block line tracing so I don’t understand how the enemy could see me with the behavior task

I changed it to block and then the enemy could damage me but it wouldn’t understand that it could see me and would be stuck in the find cover state

I think it might have something to do with your “Clear focus” node or something like that. It sounds like you may be changing the state from “Attacking” and it’s not changing back. Maybe look into your code and find where the state is being told to change TO and FROM “Attacking” and see if that’s the cause! :slight_smile: But it sounds like if it’s getting to damage the player, your line trace is fine, do not change it.

I solved it by changing the sight trace to camera

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.