Pages

Saturday, July 12, 2014

Tips #1 Rotating player with camera in TPS

I will show how we can rotate player with the camera, just like in max payne 2.

what we have to do is create and apply a script on player.
In function update, write

transform.eulerAngles.y=Camera.main.transform.eulerAngles.y

transform.eulerAngles.y will give the state of rotation of main camera about vertical axis whose value we are assigning to the state of rotation of the player. We can use other cameras as well, for that instead of camera.main.transform, we have to give another variable of type transform whose rotation we want the player to follow. Keep reading for more tips.

No comments:

Post a Comment