- Home /
A newbie to unity.Working on a game,Need HELP !!?!
I am working on a temple run style game and i am having problems two problems.
First and the Most annoying is that my player and camera are moving in a straight line.I have made it look like Camera is following the player.Both are moving with same speeds along Z axis.But the problem is the player is moving faster then camera and after some time of playing,the player goes out of Camera view range.
Here's how script looks like.. MovSpeed : float = 120.0;
function Update(){
transform.Translate(0,0,120.0*Time.deltaTime);
}
Such type of script is attached to both Camera and player.What should I do to make camera and player move with constant speed ?!? Is there any other method which is better then this i should use ?
Can you please make this title and all future titles actually describe your problem? Everyone here Need Help !!?! , this is totally unnecessary.
newbie to unity.Working on a game,Need HELP !!?!* : this tells us nothing
Have the camera turn and follow the player : this actually tells us what this question is about. And yes, I only came here to complain about your title.
Watch : http://video.unity3d.com/video/7720450/tutorials-using-unity-answers
There is a script in the standard assets scripts called SmoothFollow. You can possibly start there
DO NOT post "Answers" when you want to comment - there's an Add New Comment button on the right of the screen. On UA Answer means Solution and not Reply.
Answer by dorpeleg · Mar 27, 2013 at 04:53 PM
I see 2 better ways of making the camera follow the player.
Attache the camera to the player
Change the camera script to somthing like: camera.transform.postion = player.transform.position.
On the sencond option, you will also need to add a small location fix like: + new Vector3(0,1,0); or somthing like that.
I will try the 2nd option,as 1st one isnt the one i need.
Answer by $$anonymous$$ · Mar 28, 2013 at 10:44 AM
Just attach the SmoothFollow script to the Camera drag you Player in the field "Target".