I am trying to make a 2d game just for fun, I am having some problems with the camera. When I rotate the player the camera rotate too because is child of player, but I want to rotate just the player.
Can someone help me with this?
I would recommend you make the camera a seperate object and then put a script on it so it follows the player. E.g:
private var heightOffSet : Vector3 = Vector3(0,400,0); //height offset from player for camera
private var player : GameObject; //the main player game object
function Start ()
{
player = GameObject.Find("Player"); //find game object player and assign
}
function Update ()
{
//follow player position
transform.position = player.transform.position + heightOffSet; //have the camera follow the player based on current height offset
}
you’ll need to play with vector height offset to set it to your needs… angle the camera how you like it and then use this to set the distance - you’ll need to use position x y z depending if your game is top down or side view…etc…
hope that helps,