Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Resolved Spawning bullet out of the player

Discussion in '2D' started by bboodd24, Jun 14, 2020.

  1. bboodd24

    bboodd24

    Joined:
    Jul 10, 2019
    Posts:
    2
    Hello, first of all I have to say that I tried Physics2D.IgnoreCollision which didn't solve my problem that's why I'm writing this thread.
    What I'm trying to achieve is to shoot a bullet from the player's position to the pointer position, that part I got covered but the problem is that I need to destroy the bullet OnTriggerEnter and it always stops in my player.
    I had 2 main ideas for fixing this but I don't have enough experience in Unity for applying any. The first idea would be to have a circle with a specific radius around the player and either get the point (on the circle) the closest to the mouse pointer, or the point at a specific angle on the circle.
    The second idea would be to use the player's position and the pointer's position to somehow make the bullet spawnpoint closer to the pointer but I'd like to have a fixed distance from the player (not a %).
    If anybody could help I would be really grateful.
    Have a great day
     
    Last edited: Jun 14, 2020
  2. bboodd24

    bboodd24

    Joined:
    Jul 10, 2019
    Posts:
    2
    How can I close a thread ?