- Home /
Question by
Eco-Editor · Aug 03, 2017 at 09:36 AM ·
cameravrreferencechild objectavatar
How do I reference the cameraEye in another script
Hello all,
I want to reference the cameraEye component (from [CameraRig] SteamVR). CameraEye is a child object and I want a custom avatar to follow it's transform as if my player has a body (this is for a multiplayer game purpose).
The custom avatar is also a child object of [cameraRig], but not the cameraEye.
What are the steps for this reference? This is my script, what is not working here?
public float offset;
public Transform cameraEyes;
private Animator playerAnimator;
Vector3 lastPosition;
public float thresholdPlayAnimation = 0.1f;
private void Start()
{
cameraEyes = transform.Find("Camera (eye)");
playerAnimator = GetComponent<Animator>();
}
Thank you
Comment
You shouldn't use transform.Find();
but as @NorthStar79 mentioned: GameObject.Find();
ins$$anonymous$$d.