Unity/3d/2点間角度
提供: 初心者エンジニアの簡易メモ
他のオブジェクトの方を向く
var quaternion = Quaternion.LookRotation(target.position - player.position); target.transform.localRotation = quaternion;
参考:https://www.create-forever.games/distance-rotation-quaternion/
角度を上書き
xとzを0に上書き
var quaternion = Quaternion.LookRotation(target.position - player.position); target.transform.localRotation = quaternion; target.transform.localRotation = new Quaternion(0f, target.transform.localRotation.y, 0f, target.transform.localRotation.w);