Quantcast
Channel: Questions in topic: "rotating"
Viewing all articles
Browse latest Browse all 173

Rotating single axis like the same axis of an other gameobject

$
0
0
In my game i'm trying to rotate the x-axis of the head of the player like the x-axis of the camera in it, but i don't know how to do that. I know how to rotate single axes, but not how to rotate them like an other gameobjects axis. Here`s my code, which doesn't work, because there it is rotating all the axes: using UnityEngine; using System.Collections; public class Kopf : MonoBehaviour { public GameObject MainCamera; public GameObject Camera2; void Update () { if (MainCamera.activeInHierarchy) { transform.rotation = MainCamera.transform.rotation; } if(Camera2.activeInHierarchy) { transform.rotation = Camera2.transform.rotation; } } }

Viewing all articles
Browse latest Browse all 173

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>