- Home /
Question by
NinjaRubberBand · Mar 16, 2013 at 01:32 PM ·
movementaxis
X and Y Camera Movement
Hey guys, i want my Camera to follow my charachter the Y Axis but not the X. How do i do that?
Comment
Answer by Nelis · Mar 16, 2013 at 01:39 PM
Here is how I did it:
//set this to the object to follow
var followObject : GameObject;
//I recommend moving the camera in the LateUpdate method
function LateUpdate()
{
var camPos : Vector3 = Camera.main.transform.position;
camPos.x = followObject.transform.position.x;
Camera.main.transform.position = camPos;
}
I have not tested it, but i should work. -Nelis
Answer by NinjaRubberBand · Mar 16, 2013 at 01:54 PM
Hmm, i attached it to my Camera but nothing seems to happen
Your answer
Follow this Question
Related Questions
Move object from a to b 1 Answer
Character Axes Rotation Problem 3 Answers
Virtual directional pad 1 Answer
Transform.right misunderstanding 2 Answers
change character movement axis in respect to camera orientation? 1 Answer