more precise door detection
This commit is contained in:
parent
5094c9574c
commit
162bea0217
1 changed files with 1 additions and 1 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue