[HELP] AI Perception sight

Thank you for the opportunity it was an honor to me! :blush:

Still a little surreal (the right term?) to end up finding my name attached to all of this, I know it’s been a long time but good job!

I have a question regarding this type of functionality. Let’s say I dynamically place a bench on the ground during run time (or even in the editor before I begin play). The bench is of class Actor. As far I’m aware, because it is an actor, I have to add AIPerceptionStimuliSource to register itself as a source for AI to detect. Let’s say that the pivot point is at the base of the bench, and because of floating point errors, there is a lot of inconsistency in terms of AI being able to see the bench, as, I’m assuming the AIPerceptionStimuliSource is at the pivot point and is sometimes technically ~0.0000001 units below ground, or whatever the error comes out to being. See below for example:

With all that said, I initially though that I could add a socket to the static mesh of the actor, and then apply a similar solution to what’s been provided in the blog, but I think that because the stimuli source is not integrated like it is in ACharacter, I am not able to hook things up as done here… The only real difference between my method and the one here is that I have to get a hold of the static mesh to get its sockets, rather than the skeletal mesh.

Hm. I’d rather not convert every actor that I’d like to be detectable by this method into a character or pawn… That seems overkill…Or is it? I suppose I could potentially move the pivot point into the centre of the mesh and then add an offset when I place it so it doesn’t get placed into the ground… But I feel like that is avoiding the problem. I think it would be nice to apply this same functionality to things other than characters. Maybe I’m missing something. Does anyone have any thoughts?

Darren

I opted for a clumsy workaround… I created an actor blueprint that has a scene component and an AIPerceptionStimuliSource that autoregisters for sight. I then added a child actor to my main bench and offset it above the ground. When the AI senses the child actor, I simply get the parent actor and set that as my AI’s target… Until someone smarter than me comes around, I’ll stick with this for now!

Privacy & Terms