Spawn AI with C++ Problems

Hello,

I want to spawn my AI with C++. So far so good i did this, but the AI stay in the Air, no gravitiy.

Can anybody help me?

My Code:

UPROPERTY(EditAnywhere)
	TSubclassOf<APawn> ActorToSpawn;

APawn* bot = this->()->SpawnActor<APawn>(ActorToSpawn, FVector(x, y, z), FRotator(0.0f, -90.0f, 0.0f), ActorSpawnParams);

Greets

Did you set AIControllerClass in your Pawn defaults (constructor in case of C++)?

Yes, if i spawn my AI via Blueprint all works fine

You sure you spawning same class in both cases?

(i guess) you’re spawning from class APawn - a Pawn doesn’t have a capsule or gravity. spawn ai to be subclass from acharacter if you want this (and also movement component etc…). why things are different in BP I can’t tell you.