Problem with Spawn Actor

Hi, I’ve try to make pawn moving around itself in level blueprint, and it work.
Then I try to make a spawn point from the “Spawn Actor” function that my pawn can spawn and move but it can’t move at all!!!
I notice that if spawn point is above the ground the pawn will not drop to the ground unlike I drag pawn blueprint to level directly.

so I’m not sure what the problem is.

Thank you

It may be that the actor you are creating has no gravity applied.

Have you checked that it has physics enabled on it?

When you drag in an actor or something from the Content Browser, it tries to place anything being added flush with any planes it is being dragged over.

However something being spawned, is just created at the spawn point.
And if that is above ground, with no physics, it will just sit there.

1 Like

I have the same thing! I drag and drop my characterBlueprint directly into the level and all physics on the pawn work properly (e.g. pawn drops to the ground if it was placed too high)! But if I spawn the same characterBlueprint with Spawn Actor from Class from a blueprint, it won’t! I was able to tweak a few things to fix that, but then always something else went weird.

Also related to this: I tried the same thing in Epic’s Shooter Game: When using Spawn Actor from Class to spawn the botPawn it seems no physics where applied and AI wasn’t working. When using Spawn AI physics were working but AI still wasn’t! And again, when I drag and dropped the BotPawn blueprint into the level directly, the AI was working without any issues!

Hi Tucarius and Five_0
Thank you for answer me.

Yes I already enable physic.

I put it above the floor and when I start simulate or play, It fall down before stand on the ground.

PS. If I use actor blueprint class it fall down and seem that it got normal physic but when I use character blueprint class It just float in there.

I found the solution

https://answers.unrealengine.com/questions/4912/bug-spawned-actor-works-differently-from-the-bluep.html

1 Like

Hi is anyone able to shed light on what the solution to this is? The link posted from answers.unrealengine.com above links to a beta post which is inaccessible (and the main thread is closed). Also also have a problem where I’m trying to build a basic Tower Defense game to learn UE4. I have a target point hovering above ground. But when I press a button which triggers Spawn Actor From Class, the Character Blueprint just hovers in air. It doesn’t drop. and I think its because there is no controller associated but i have no idea how to do this

Edit: Ok I found my problem. I needed to set a controller to the actor I was spawning. I needed to use the blueprint “Spawn Default Controller” after calling “SpawnActor [Actor]”. Return value from Spawn Actor points to Spawn Default Controller and also “Get Controller” function. I then call Simple Move to Location pointing to my Target Point. Attached example Blueprint incase it helps anyone.

Btw, i’m currently spawning the actor with H key, but will make this a tick or event process. I’ve also attached a image showing the units spawning and running using a navmesh through the “maze” to a target point in the bottom left. The turret in the center is auto targeting the characters and shooting projectiles. I’m still learning but I’m enjoying the process so far!

Thanks all, I was struggling with this and probably would have taken ages to figure out (if ever) that one has to call “Spawn Default Controller”.

For those using behavior trees to drive AI there’s one more point worth noting: the sample behavior tree in the documentation sets up the blackboard/run behavior tree nodes in the “event begin play” of your custom AI controller. However this does not work with “Spawn Default Controller” as the “controlled pawn” node is null/none at the point preventing you from calling ‘run behavior tree’.

The alternative I found from answers hub was to call “Spawn AI Actor” instead which allows you to specify the behavior tree to run as well. However the node doesn’t let you specify which blackboard to use along with the tree so I’m doing this in a “Setup” task as the first thing in my behavior tree. Not sure if that’s ideal though so eager to know if there’s a better way.

Ok but if you dont spawn controller, why wouldn’t the bot fall with physics enabled? I had the same problem and I thought it’s something to do with collision since the bot didn’t fall when spawned in air.
Thanks for the solution mister!

Thanks! Had the same problem, the Spawn Default Controller node was missing. All works now.

… Check my solution , it may help …

I know this is an old topic, but I want to add something to try to help someone somewhen.

I had the same problems but when I connected “Spawn Default Controller” it solved only part of the problems. Part of my AI perception and animations was linked to “Event BeginPlay” and because of that I had weird behaviors.

Solution: I created a “Custom Event” at my AI Blueprint and connected it to the hole sequence of the “Event BeginPlay”, then after the “Spawn AIFrom Class” and “Spawn Default Controller” I simply used a Cast to and called that Custom Event.

This is it! Thank you!

image
This worked for me: changed from PlaceintheWorld to Spawned… (my npcs were spawned after begin play)