Change client camera when level starts

hello everyone,

I’d like to change the camera of all clients created when the level is loaded …
to a static camera already created in the level (or i can dynamically create this camera?)
Now I’m not sure how to start doing this so im very sorry for nor providing some code of my work here…

Best Regards,

Hey MrHero-

You should be able to use APlayerController::SetViewTargetWithBlend() to set which camera actor you want players to view through.


please forgive me I’m new to UE4 ,
should i call this in the begin play function and give it parameters?
or i should define the function in the character’s header first?

also if its possible one more question…
is it necessary to have validation implementation functions for begin play on the network?

Yes, BeginPlay would likely be the best place to make this call and you can check the documentation for SetViewTargetWithBlend to find the functions parameters (APlayerController::SetViewTargetWithBlend | Unreal Engine Documentation) .

URL is wrong…
the problem is not that i dont find the documentation … it’s i don’t know how to use it >,>

The url should be fixed now. Passing the actor with the camera you want the clients to view through should work for the function call. If you require all elements of the parameter list then default values should work. Here is what the blueprint node for this function looks like if you want to see what the default values are: Set View Target with Blend | Unreal Engine Documentation

for (TActorIterator ActorItr(GetWorld()); ActorItr; ++ActorItr)
if (ActorItr->GetName() == “LevelCamera”)
APlayerController::SetViewTargetWithBlend(&ActorItr, 0.0f, VTBlend_Linear, 0.0f, false);

this is What i did in the begin play Im not sure what is wrong

Are you getting a compile error or is the result in game not what you expected? If you are getting an error please let me know what it is. From what I can see of this code it looks like you’re cycling through multiple cameras and setting the view to each camera as you pass through rather than setting the client view to a specific camera.

i get a syntax error where SetViewTargetWithBlend is not a member of APlayerController…

mmm i need to have my clients in the for loop and then set the view port i see…
but how would i assign the Actor in the SetViewTargetWithBlend function?

Hey MrHero-

Can you explain what the error is that you’re getting? I was able to create a class based on actor with a box component and camera component. Using a dynamic binding, I was able to switch view from the default third person camera to the camera for my class when overlapping the box. I’ve attached the files for the class I setup for you to use as reference.


link text