Closed mirchd closed 6 years ago
look at cmplayercontroller.lua.
function CMPlayerController:SpawnPlayer()
local SpawnLocation = FVector.New(0, 0, 300)
local SpawnRotation = FRotator.New(0,0,0)
local transfrom = UKismetMathLibrary.MakeTransform(SpawnLocation, SpawnRotation, FVector.New(1, 1, 1))
local spawnActor = UGameplayStatics.BeginDeferredActorSpawnFromClass(self, self.m_DefaultPawnClass, transfrom, ESpawnActorCollisionHandlingMethod.AlwaysSpawn, self)
spawnActor = UGameplayStatics.FinishSpawningActor(spawnActor, transfrom)
self.PlayCharacter = spawnActor
self.m_PlayCharacter = spawnActor
spawnActor:SetPlayerController(self)
end
Thank you very much~
Please help, I want to spawn a actor in lua, the cpp class is Inherited from AActor. Thanks.