target | Objeto para apuntar hacia. |
worldUp | Vector especificando la dirección hacia arriba. |
Gira el transform para que el vector hacia adelante apunte en la posición actual del target
.
Then it rotates the transform to point its up direction vector in the direction hinted at by the worldUp
vector.
If you leave out the worldUp
parameter, the function will use the world y axis. The up vector of the rotation will only match the worldUp
vector if the forward direction is perpendicular to worldUp
.
using UnityEngine; // This complete script can be attached to a camera to make it // continuously point at another object.
public class ExampleClass : MonoBehaviour { public Transform target;
void Update() { // Rotate the camera every frame so it keeps looking at the target transform.LookAt(target);
// Same as above, but setting the worldUp parameter to Vector3.left in this example turns the camera on its side transform.LookAt(target, Vector3.left); } }
worldPosition | Punto a mirar. |
worldUp | Vector especificando la dirección hacia arriba. |
Gira el transform para que el vector hacia adelante apunte a worldPosition
.
Then it rotates the transform to point its up direction vector in the direction hinted at by the worldUp
vector.
If you leave out the worldUp
parameter, the function will use the world y axis. The up vector of the rotation will only match the worldUp
vector if the forward direction is perpendicular to worldUp
.
using UnityEngine;
public class ExampleClass : MonoBehaviour { public Transform target;
void Update() { // Point the object at the world origin (0,0,0) transform.LookAt(Vector3.zero); } }