TriLib  1.8.7f
TriLib Unity Package
TriLib.CameraExtensions Class Reference

Represents a series of UnityEngine.Camera extension methods. More...

Static Public Member Functions

static void FitToBounds (this Camera camera, Transform transform, float distance)
 Frames the UnityEngine.Camera to encapsulate the UnityEngine.Transform child bounds. More...
 

Detailed Description

Represents a series of UnityEngine.Camera extension methods.

Member Function Documentation

◆ FitToBounds()

static void TriLib.CameraExtensions.FitToBounds ( this Camera  camera,
Transform  transform,
float  distance 
)
static

Frames the UnityEngine.Camera to encapsulate the UnityEngine.Transform child bounds.

Parameters
cameraUnityEngine.Camera that will frame the transform.
transformUnityEngine.Transform that will be framed.
distanceDistance from the transform to place the camera.
protected void Awake() {
GameObject myGameObject;
try {
using (var assetLoader = new AssetLoader()) {
gameObject = assetLoader.LoadFromFile("mymodel.fbx");
}
} catch (Exception e) {
Debug.LogFormat("Unable to load myModel.fbx. The loader returned: {0}", e);
}
//Frames "myGameObject" with the main camera at 2 units of distance
Camera.Main.FitToBounds(myGameObject.transform, 2f);
}

The documentation for this class was generated from the following file: