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

Can you be more specific? I mean, the camera already does adjust with F to size of object.

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.

Ok, but this already happens with F during simulation. I think I’m missing something…

Is this for gameplay or for editor use?

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.

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. :expressionless:

I don’t think so…

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 'm trying your method,
“GetComponentBounds” is the function
that get the size of the mesh right?

Yes.

Is the whole scripts in level or class
blueprint?

You can use it anywhere.

I’m confused about the target of the
“set” part, the camera cannot be
linked there.

It has to be a springarm the camera is usually attached to.

I did this, but it needs a lot of tweaking:

306335-zoom.gif

[link text][4]

WOW~~,awesome

Two main things that need tweaking are:

  1. It takes the vector to look at the object from the forward vector, that’s why it goes around the back of objects sometimes.

  2. 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? :slight_smile:

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…

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.

If the object is a BP with cameras in it, then they will be taken into account, otherwise it’s just the mesh :slight_smile: