Unityの忘備録です('◇')ゞ

自分用の忘備録です!

2024-07-01から1ヶ月間の記事一覧

【Unity】Physics.Raycast.hit.pointのY軸について【忘備録】

youtu.be 動画のように先に白いPhysics.Raycastを発射し、取得したRaycastHit hit.pointの位置に 赤いPhysics.Raycastを飛ばしたけどなぜかY軸が実際より上に位置していました(;'∀')その時のコード direction = target.position - myEyes.position; Ray ray …

【メモ】HitしたColliderの方角へ振り向く

自分用('◇')ゞ 敵のスクリプト(EnemyManager)に追記 void OnTriggerEnter(Collider col) { //Debug.Log(col.gameObject.name); if (col.gameObject.name == "Bullets") { Vector3 direction = col.transform.position - transform.position; Quaternion ro…