Background Type 속성
Projection 속성
원근 투영은 인간의 눈과 유사한 방식으로 장면을 투영합니다. 가까운 물체는 더 크게, 먼 물체는 더 작게 보이는 효과를 줍니다. 이는 깊이감과 현실감을 더해주기 때문에 3D 게임과 애플리케이션에서 자주 사용됩니다.
직교 투영은 물체의 거리에 상관없이 동일한 크기로 보이게 하는 투영 방식입니다. 이는 깊이감이 없기 때문에 2D 게임이나 특정한 3D 게임 및 애플리케이션에서 사용됩니다.
Viewport Rect 속성은 X, Y, W, H 네 개의 값으로 구성됩니다. 각각의 의미는 다음과 같습니다:
- depth only와 culling mask를 사용해서 벽뒤에있는 적들을 감지하는 스킬을 구현할 수 있음.
메인카메라가 특정 오브젝트(캐릭터) 따라가기
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
public class Test : MonoBehaviour
{
[SerializeField]
private GameObject go_Target;
[SerializeField]
private float speed;
private Vector3 difValue;
private void Start()
{
difValue = transform.position - go_Target.transform.position;
difValue = new Vector3(Mathf.Abs(difValue.x), Mathf.Abs(difValue.y), Mathf.Abs(difValue.z));
}
void Update()
{
this.transform.position = Vector3.Lerp(this.transform.position, go_Target.transform.position + difValue, speed);
}
}
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
public class Test : MonoBehaviour
{
[SerializeField]
private GameObject go_Target;
[SerializeField]
private float speed = 1.0f; // 기본 속도 값 설정
private Vector3 difValue;
private void Start()
{
if (go_Target == null)
{
Debug.LogError("Target GameObject is not assigned.");
return;
}
difValue = transform.position - go_Target.transform.position;
}
void Update()
{
if (go_Target == null) return;
Vector3 targetPosition = go_Target.transform.position + difValue;
transform.position = Vector3.MoveTowards(transform.position, targetPosition, speed * Time.deltaTime);
}
}
애니메이션(animation) (0) | 2024.06.26 |
---|---|
라이트(Light) (0) | 2024.06.26 |
MeshRenderer, 마우스 클릭시 오브젝트 색 바꾸기 (0) | 2024.06.25 |
박스 콜라이더, 레이캐스트, OnTriggerEnter, OnCollisionEnter (0) | 2024.06.25 |
리지드바디(Rigidbody), 이동, 회전, 폭발 (0) | 2024.06.24 |