Creation and manipulation of camera objects #43
-
Hi! I am kinda ashamed to have spent a couple of hours on this, and I just don't get it. I have created a Blueprint class of typ CameraActor in my content named "bpCameraActor". I have set the properties as I want it to be. I now want to do the following at the creation of my Testclass (that gets instantiated at Main.OnWorldBegin ) Problem 1:
Problem 2: To be clear: The C# part of creating classes, instantiation, Interfaces etc. is not a problem for me. It's the creation of, and required class structure to UE objects that is a puzzle to me. Can I move a camera in code, or has it have to be somehow related to a player component? And even the words in that question is mostly a guess :-) Help please :-) BR |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
First things first, make sure that you are familiar with GameMode and how it's used. This API is not exposed yet, but for now, you can use a blueprint to set up default classes with
That said, to just switch between cameras, you can use the same approach but from managed code with
The most straightforward way is to retrieve an actor from the world by predefined name or tag, and get an attached component of a specified type. This functionality is based on generics, so you only need to specify the appropriate types, optionally with specified names or tags.
Please, use learning materials from the internet if it's not related to the plugin itself. It will take less time to get things done rather than wait for a reply here, and most of the C++ and blueprints experiences can be used to write managed code with the plugin. |
Beta Was this translation helpful? Give feedback.
-
Dear Stanislav Please bare with me :-) I have spent hours trying to get a C++ example that makes sense, but failed. I truly am not wasting your time without first trying to solve my issues by other means. So basically the code to create an instance of a content is:
Can you please help? BR |
Beta Was this translation helpful? Give feedback.
First things first, make sure that you are familiar with GameMode and how it's used. This API is not exposed yet, but for now, you can use a blueprint to set up default classes with
PlayerController
and set a customPlayerCameraManager
.That said, to just switch between cameras, you can use the same approach but from managed code with
PlayerController.SetViewTarget()
orPlayerController.SetViewTargetWithBlend()
. To change the location retrieveSceneComponent
from theCamera
actor.The most straightforward way is to retrieve an actor from the world by predefined name or tag, and get an attached component of a specified type. This functionality is based on generics, …