I’ve been struggling with building a simple enemy Pawn BP that moves around and collides with things, including the ability to fall. I have finally proven that my setup using SetActorLocation + “Sweep” is getting the OnComponentHit notification from an object that tells the enemy to move in another direction (a fake trigger I built). However, if I set it up one way, it never falls, but the only other way I can see makes it roll around randomly (Simulate Physics).
My setup is as follows: I have a Pawn BP with a StaticMesh and a Sphere Collision Component. I am using SetActorLocation to move it in a direction. If I have “Simulate Physics” set on the sphere but not on the StaticMesh it moves in the direction I request, but does not fall. It also doesn’t give me OnComponentHit events against my trigger object. However, if I set “Simulate Physics” on both components (or just on the StaticMesh), it falls, and gives me OnComponentHit events. These OnComponentHit events also seem really finicky and I haven’t tracked down how to make them work as expected. One of my test objects doesn’t trigger it, but the other does. With “Simulate Physics”, it then proceeds to just roll around and never ends and doesn’t honor my SetActorLocation calls.
I’ve read a number of articles on this and many people have seemed to struggle with it. Is there an official page that describes this process? If not, is there any advice you can give me that can help me track this down? Why do I not get OnComponentHit events when “Simulate Physics” is set on the Sphere Component, but do on the StaticMesh? Is there a way to prevent the enemy from just bouncing around and instead stick to the object like a character controller does…while honoring SetActorLocation?
I understand that I could just use a character controller, but it has it’s own issues I’m trying to get around (I’ll save that for another thread), and doing that doesn’t let me understand the full process.
As a side note, any idea why having the enemy setup to simulate physics (causing it to roll around) would launch it into the air at the start of the level, even if it starts 500 feet up in the air?
Please let me know if there is any more information I can provide that will help. Thanks!