Unity
- 4 ответа
- 0 вопросов
4
Вклад в тег
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.CompareTag("FirstPart"))
{
Destroy(gameObject);
}
}
Для 2D:
private void OnCollisionEnter2D(Collision2D col)
{
if (col.gameObject.CompareTag("FirstPart"))
{
Destroy(gameObject);
}
}
private bool IsCrashed()
{
Vector3 offset = new Vector3(0, 0.1f);
return Physics2D.BoxCast(playerCollider.bounds.center + offset, playerCollider.bounds.size, 0f, Vector2.down, .1f, groundMask);
}