31 lines
638 B
C#
Raw Normal View History

2025-01-17 13:10:20 +01:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Meteor : MonoBehaviour
{
public Rigidbody rigidbodyComponent;
public Vector3 RotationVector;
private void FixedUpdate()
{
rigidbodyComponent.velocity = new Vector3(0.5f, -0.7f, 0);
this.transform.Rotate(RotationVector * Time.deltaTime);
if (this.transform.position.y < -20)
{
Destroy(this.gameObject);
}
}
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.layer != 6)
{
Destroy(other.gameObject);
}
}
}