public Rigidbody2D rigidbody2D;
float angle;
void OnTriggerEnter2D(Collider2D other) {
if (other.gameObject.tag == "Player" || other.gameObject.tag == "Boss" || other.gameObject.tag == "GameWin" || other.gameObject.tag == "Fruit" || other.gameObject.tag == "checkPoz") {
} else {
Destroy (gameObject);
}
}
void Update()
{
Vector2 v = rigidbody2D.velocity;
angle = Mathf.Atan2(v.y, v.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
}
float angle;
void OnTriggerEnter2D(Collider2D other) {
if (other.gameObject.tag == "Player" || other.gameObject.tag == "Boss" || other.gameObject.tag == "GameWin" || other.gameObject.tag == "Fruit" || other.gameObject.tag == "checkPoz") {
} else {
Destroy (gameObject);
}
}
void Update()
{
Vector2 v = rigidbody2D.velocity;
angle = Mathf.Atan2(v.y, v.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
}
No comments:
Post a Comment