- Home /
Why didnt my Collider works?
I want that my bullet collides with a Meteorit but it diddnt work. I have a Capsule Collider on my Bullet and the Trigger is on. The Meteorit has a edge Collider an the Trigger is off. But their is no Console info.
This is my Code for the Bullet:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class bullet : MonoBehaviour
{
public int speed;
// Start is called before the first frame update
void Start()
{
GetComponent<Rigidbody2D>().velocity = transform.up * speed;
}
void OnTriggerEnter2D(Collider2D other)
{
Debug.Log(other.name);
}
}
You need a rigidbody on at least one of the colliders. Give the meteorite a rigidbody and set is to is kinematic so it shouldnt affect anything, but it will still register detection
Your answer
Follow this Question
Related Questions
The player randomly freezes in place while other objects move ingame 1 Answer
Problem with Falling Platform Script 3 Answers
Stuttering in simple 2D game using interpolation? 1 Answer
Problem with 2D movement. My character is moving by himself between two points... :) 1 Answer
When 2D Car Turns Upside Down, Game Over Scene Should appear. 1 Answer