Look at like rotating around y axis


Ive got a little problem - i would like my char to rotate relatively to other object around y axis similar as it it done with transform.LookAt() function

Could someone help me out?

Thanks in advance!

You can use transform.RotateAround. The example below rotates the object around other defined in center at rps rotations per second. I don’t remember if it also keeps looking at the center; if not, add a transform.LookAt(center); after RotateAround.

var center: Transform; //<- Drag the center object here
var rps: float = 3; // speed in rotations per second

function Update() {
    transform.RotateAround (center.position, Vector3.up, rps * Time.deltaTime);