Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# unity camera follow player horizontal axis

public Transform Target;
Vector3 tempVec3 = new Vector3();

void LateUpdate()
{
    tempVec3.x = Target.position.x;
    tempVec3.y = this.transform.position.y;
    tempVec3.z = this.transform.position.z;
    this.transform.position = tempVec3;
}
Source by gamedev.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #unity #camera #follow #player #horizontal #axis
ADD COMMENT
Topic
Name
2+4 =