Hey! I was hoping that someone could help me with this matter. I am trying to instantiate an actor in the world and make it follow the camera as if it were a child of the camera. I do not know how to do this, however…I was also wondering what the best way of instantiating an actor is, because the way that I am doing it right now does not seem to work very well. Here is my script:
/*FActorSpawnParameters SpawnInfo; SpawnInfo.bNoCollisionFail = true;*/ wp.wpPos = FirstPersonCameraComponent->RelativeLocation + wp.wpPosOffset; wp.wpRot = FirstPersonCameraComponent->RelativeRotation + wp.wpRotOffset; wp.ItemClass = World->SpawnActor<AWeapon>(wp.ItemBlueprint, wp.wpPos, wp.wpRot); //wp.ItemClass = World->SpawnActor<AWeapon>(wp.ItemBlueprint, wp.wpPos, SpawnInfo);
However with this script, the item spawns somewhere in the middle of the level and not really at the relative location of the camera (I set wpPosOffset and wpRotOffset to zero for testing purposes). In the shootergame example, they use “FActorSpawnParameters”, but I have no idea how to implement it because I always get errors. I really appreciate any type of insight that would help me with this. Thank you in advance for any contributions!