WIP door detection
This commit is contained in:
parent
e49d5d2ea4
commit
e3eefc901c
1 changed files with 3 additions and 5 deletions
|
@ -79,13 +79,11 @@ public class Door : MonoBehaviour {
|
|||
Player player = collision.gameObject.GetComponent<Player>();
|
||||
Vector2 centerToCollider = (Vector2) gameObject.transform.position - parent.GetPosition() + parent.GetCenter();
|
||||
Vector2 centerToPlayer = (Vector2) player.gameObject.transform.position - parent.GetPosition() + parent.GetCenter();
|
||||
if (centerToCollider.magnitude - 0.89 < centerToPlayer.magnitude) {
|
||||
Debug.Log(centerToCollider.magnitude - 0.89);
|
||||
Debug.Log(centerToPlayer.magnitude);
|
||||
float angle = Vector2.Angle(( centerToPlayer - centerToCollider ), toOuter);
|
||||
if ( (angle > 90 && angle < 270) ) {
|
||||
Debug.Log("Player is on the outside! Angle: " + angle);
|
||||
return;
|
||||
}
|
||||
Debug.Log(centerToCollider.magnitude - 0.89);
|
||||
Debug.Log(centerToPlayer.magnitude);
|
||||
Debug.Log("Leaving Trigger");
|
||||
if(parent == null) {
|
||||
Debug.Log("This door has no parent Room!");
|
||||
|
|
Loading…
Add table
Reference in a new issue