ソウルライクなカメラスクリプト Unityには高度なカメラ制御ができる Cinemachine があるがソウルシリーズの様なロックオンをイメージして使ってみると違和感がある。自分が Cinemachine に対する知識に疎いからかもしれないが、シンプルに使えるカメラスクリプトが欲しかったので自作した。 ThirdPersonCamera using System.Collections; using UnityEngine; [RequireComponent(typeof(Camera))] public class ThirdPersonCamera : MonoBehaviour { public GameObject primaryTarget; public GameObject secondaryTarget; public Vector2 primaryLockOnPosition = new Vector2(0, 0); public Vector2 secondaryLockOnPosition = new Vector2(0, .3f); public CameraMode cameraMode; public float distance = 4; public float height = 1.5f; public float delay = 2; [Range(0, 1)] public float maxVerticalRotationLimit = .9f; [Range(0, 1)] public float minVerticalRotationLimit = .9f; public LayerMask layerMask; public float castRadius = .6f; [Range(.001f, 1)] public float lockOnSpeed = .1f; public AnimationCurve shakeDecayCurve = new AnimationCurve(new Keyframe(0, 1), new Keyframe(1, 0)); ...
コメント
コメントを投稿