GetActorLocation() fed to SpawnActor() not working
So I'm trying to spawn a weapon actor when my character drops a weapon, so it looks like the weapon is being dropped. When I call SpawnActor and feed it a location like FVector(0,0,0), it spawns the actor at the position I give it. But when I give SpawnActor something like GetActorLocation(), it doesn't appear to spawn the actor. I'm calling this from within my character's class.
Does SpawnActor() not accept GetActorLocation() as a parameter? Does my character have to have a particular root component selected? I've even tried feeding SpawnActor the following: GetMesh()->GetComponentLocation() and it still doesn't seem to spawn the actor.
Thanks for your help.
asked Jan 31 '16 at 07:06 PM in C++ Programming
So I got it to work. The thing is this. For each weapon in my game, I have two different classes and hence two different blueprints. One is the Pickup version, and it hovers in the world waiting for the character to pick it up. Then there is the Weapon version, which is what is spawned and attached to a socket on the character. The Pickup class contains a UClass* pointer to the Weapon blueprint. When I try to spawn the pickup version, it doesn't accept character->GetActorLocation() as a location, but when I spawn the Weapon version, it works just fine. I don't know if this is a bug, or what.
answered Feb 01 '16 at 07:14 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here