unity - camera smooth follow

반응형
if(cameraFollowX)
{
Vector3 targetPos = new Vector3(cameraTarget.transform.position.x, thisTransform.position.y, thisTransform.position.z);
Vector3 localVel = new Vector3(velocity.x, 0.0f, 0.0f);
thisTransform.position = Vector3.SmoothDamp(thisTransform.position, targetPos, ref localVel, smoothTime);
}
if(cameraFollowY)
{
Vector3 targetPos = new Vector3(thisTransform.position.x, cameraTarget.transform.position.y, thisTransform.position.z);
Vector3 localVel = new Vector3(0.0f, velocity.y, 0.0f);
thisTransform.position = Vector3.SmoothDamp(thisTransform.position, targetPos, ref localVel, smoothTime);
}

 

'Unity > Unity Study' 카테고리의 다른 글

C# keywords  (0) 2015.02.18
void OnDrawGizmos()  (0) 2013.12.18
Unity - Character Controller  (0) 2013.11.03
unity - time 출력  (0) 2013.10.30
unity - time 관련 함수  (0) 2013.10.30
TAGS.

Comments