CharacterControllerを使用した場合の当たり判定
![8c5ffe1d 03ce 46a1 b7c0 9129e66fc4b7](https://codegenius.org/uploads/slide/image/2094/8c5ffe1d-03ce-46a1-b7c0-9129e66fc4b7.jpeg)
プレーヤーをワープさせる
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerWarp : MonoBehaviour {
// このスクリプトは「CharacterController」を追加したオブジェクトにつける(ポイント)
void OnControllerColliderHit(ControllerColliderHit hit){
if (hit.gameObject.tag == "Warp") {
transform.position = new Vector3 (0, 21, 0);
}
}
}
![F202bb1b abd1 4a25 9334 cdad5abde4c2](https://codegenius.org/uploads/slide/image/2095/f202bb1b-abd1-4a25-9334-cdad5abde4c2.jpeg)
![5207e33b 150d 4bb0 8705 c64950ef9aa0](https://codegenius.org/uploads/slide/image/2096/5207e33b-150d-4bb0-8705-c64950ef9aa0.jpeg)
![A509e975 f754 4a5e a4dc 62489ccb19b7](https://codegenius.org/uploads/slide/image/2097/a509e975-f754-4a5e-a4dc-62489ccb19b7.jpeg)
![8c5ffe1d 03ce 46a1 b7c0 9129e66fc4b7](https://codegenius.org/uploads/slide/image/2094/8c5ffe1d-03ce-46a1-b7c0-9129e66fc4b7.jpeg)
プレーヤーをワープさせる
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerWarp : MonoBehaviour {
// このスクリプトは「CharacterController」を追加したオブジェクトにつける(ポイント)
void OnControllerColliderHit(ControllerColliderHit hit){
if (hit.gameObject.tag == "Warp") {
transform.position = new Vector3 (0, 21, 0);
}
}
}
![F202bb1b abd1 4a25 9334 cdad5abde4c2](https://codegenius.org/uploads/slide/image/2095/f202bb1b-abd1-4a25-9334-cdad5abde4c2.jpeg)
![5207e33b 150d 4bb0 8705 c64950ef9aa0](https://codegenius.org/uploads/slide/image/2096/5207e33b-150d-4bb0-8705-c64950ef9aa0.jpeg)
![A509e975 f754 4a5e a4dc 62489ccb19b7](https://codegenius.org/uploads/slide/image/2097/a509e975-f754-4a5e-a4dc-62489ccb19b7.jpeg)
CharacterControllerを使用した場合の当たり判定