- Home /
Set up camera target automatically
I have this code:
WowCamera.Instance.TargetLookAt = ragdoll.transform.FindChild("pelvis/root/hips/PuntodeCamara");
But I need to change this code, the main camera is called WowCamera, and I need to tell the camera to automatically look at the null target called PuntodeCamara.
My character is named ANTU4 and the null PuntodeCamara is placed inside the armature hierarchy. But the code doesnt have an instance called TargetLookAt, I just copied this code from another script.
I only need to tell the camara to "look" at the null PuntodeCamara, inside the ANTU4 hierarchy automatically.
Here is a photo of my characters hierarchy:
What do you mean when you say PuntodeCamara is null? Also, there is no TargetLookAt
or FindChild
methods in the Unity API.
Try WowCamera.transform.LookAt(GameObject.Find("PuntodeCamara"))