I downloaded aiImporter for realtime import FBX object, but the object is too big and out of screen. What can I do? Is there any method to scale/translate camera to fit it?
You could move the camera dependent on the mesh bounds of your model (assuming your model is at (0, 0, 0)):
Vector3 xyz = recap360GameObject.GetComponent<MeshFilter>().mesh.bounds.size; float distance = Mathf.Max(xyz.x, xyz.y, xyz.z); distance /= (2.0f * Mathf.Tan(0.5f * yourCamera.fieldOfView * Mathf.Deg2Rad)); // Move camera in -z-direction; change '2.0f' to your needs yourCamera.transform.position = new Vector3(yourCamera.transform.position.x, yourCamera.transform.position.y, -distance * 2.0f);
Can you just scale down the fbx object? When you import it, go to the object, on the Inspector of that object go to the Transform, reduce the “Scale” of the x,y and z numbers.
You could also do a prefab and reduce the scale of the prefab.
distance /= (2.0f * Mathf.Tan(0.5f * yourCamera.fieldOfView * Mathf.Deg2Rad));
I did not understand here. Would you please explain it in detail?