1
0
Fork 0

more precise door detection

This commit is contained in:
Saibotk 2018-04-24 20:35:31 +02:00 committed by Piegames
parent 5094c9574c
commit 162bea0217

View file

@ -85,7 +85,7 @@ public class Door : MonoBehaviour {
// TODO only works correct for entering a room! // TODO only works correct for entering a room!
if ( collision.tag == "Player") { if ( collision.tag == "Player") {
Player player = collision.gameObject.GetComponent<Player>(); Player player = collision.gameObject.GetComponent<Player>();
Vector3 colliderToPlayer = player.gameObject.transform.position - ( gameObject.transform.position - (Vector3) (0.6f * (Vector2) toOuter)); Vector3 colliderToPlayer = player.gameObject.transform.position - ( gameObject.transform.position - (Vector3) (1f * (Vector2) toOuter));
float angle = Vector2.Angle(toOuter, colliderToPlayer); float angle = Vector2.Angle(toOuter, colliderToPlayer);
if ( angle < 90) { if ( angle < 90) {