Can you be more specific? I mean, the camera already does adjust with F to size of object.
How can I make camera automatically change its location ,so that it would adjust to the models of different size？
It 's similar to the scenario when you select the object and press F，only I need it to appear larger in the viewport
Yes, it 's similar to the scenario when you select the object and press F，but I need it to appear larger and always occupies certain proportion of the screen in the viewport whether the object is big or small when I play the simulation.
But how to let another camera F automatically with blueprint ? gameplay sort of
Like a TPS ,only character can be 100 times bigger or very very small.
Ok, but this already happens with F during simulation. I think I’m missing something…
Is this for gameplay or for editor use?
Assuming this is for gameplay, you can adjust the length of a spring arm based on the bounds, something like this maybe:
Unfortunately, the Focus function works based on the largest component, not on the mesh. What I mean is, I have several actors that contain audio components in them. When I select such an actor and press F, the camera focuses on the sound attenuation sphere instead of the mesh, and it moves waaaaay too far and it’s impossible to use it normally. If only there was a way to change its behavior.
I now feel that I completely misunderstood what is going on here.
I 'm trying your method, “GetComponentBounds” is the function that get the size of the mesh right? Is the whole scripts in level or class blueprint? I’m confused about the target of the “set” part, the camera cannot be linked there.
I don’t think so…
I meant only change the distance between the object and those camera, then possess one of them. But I think this is more than enough already thanks a lot.
I forgot what that thing is called and I can’t seem to find it: the one that returns not the object bounds, but the sphere that starts at the object origin with the radius equal to the distance from the actor origin to its furthest vertex, that basically represents every point in space that may be occupied by the actor with all possible rotations. Maybe you can use that for more accurate camera placement?
I 'm trying your method,
“GetComponentBounds” is the function
that get the size of the mesh right?
Is the whole scripts in level or class
You can use it anywhere.
I’m confused about the target of the
“set” part, the camera cannot be
It has to be a springarm the camera is usually attached to.
Two main things that need tweaking are:
It takes the vector to look at the object from the forward vector, that’s why it goes around the back of objects sometimes.
It computes the view distance using the object’s bounds. But as the object gets bigger, the computation is a bit off, so that needs some attention…
What if I already have three camera shoot at one mesh(size unknown), their rotation are fixed, will the distance computation be easier?
Sorry, don’t quite get it. If you already have 3 cameras looking at one mesh, why would you want another?
Also, if I have understood you right, it wouldn’t make any difference, because it’s based on mesh bounds, not how many other cameras there are…