NPC spawns half into floor, won't move even if I set spawn spawn location higher.

I’ve been at this for over six hours already last night. I just loaded it back up this morning to get a fresh look real quick before I head out to work.

I have an NPC character that needs to be spawned in at a certain time (it’s random), but when it spawns, it invariably wants to spawn half-way through the floor.

I have specific spawn points for it to spawn at, and it chooses a random one and spawns there.

I’ve already tried intercepting the Z position between picking the spawn point and actually spawning the NPC and then adding 100 to it to ensure it spawns ABOVE the floor, and it does… But then it doesn’t move. I can hear the movement sound emanating from it, but it just sits there. Only now it’s suspended in the air. (Yes, gravity is on, and I’ve even tried checking “Can Fly”)

Dragging the NPC out to the level at design-time works just fine. This is only happening when I spawn the same NPC.

I’m very frustrated right now as I can find no reasonable explanation how spawning can completely break an otherwise perfectly working NPC. I shouldn’t be wasting hours on something that should have been working in less than 1 minute.

I’d send a pic of the spawning process, but there’s nothing out of the ordinary. It’s just a simple Spawn Actor From Class, and I have my BP class reference from the NPC. The same call works just fine for everything else I spawn.

Thanks! I’ll check back later for any replies. Have to get working today.

-Marc

1 Like

Hi, Marc,

A video and screenshots of your blueprints are ALWAYS helpful. Even if you think they are unnecessary. Unreal is too complicated for us to take your word that everything is in order.

1 Like

Go to NPC Class defaults, scroll down to Pawn, and set auto possess ai to “Placed in World or Spawnd”
image

1 Like

Ooh! This may be it. I had a similar problem with other AI that I spawned in, but couldn’t remember how I fixed them. This sounds familiar. I’ll let you know when I get back to my PC.

Ironically, I thought of a workaround for this one that doesn’t rely on spawning at run time (which, for this particular one, I almost like better), but I still want to see if this fixes the issue as-is for future ones.

Yea, if they’re not moving when spawned it sounds like a failure to possess issue. As for the location itself, I’d suggest making a spawn point actor class with a capsule or cylinder collision component in it so you can drag it into the level, snap it to a floor, and the collision will offset the origin where the pawn will spawn. Sort of like the default player start actors.

Just be sure to make it only collide with world so pawns wont’ get stuck on or in it. :wink:

1 Like

Excellent suggestion! Definitely will implement this. (Already have the collision setup this way on my current spawn points which carry a small version of the mesh they’re used to spawn which is only visible in the editor).

Yep! That was it. Thank you!

(I’m not seeing a way to flag your post as the answer, or even that the issue was resolved.)

You made this thread as a discussion, not a question. So, you can’t do that.