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. Dismiss Notice

Question how do i add a little thing that shows where the bullets will go?

Discussion in 'Scripting' started by SpyderManToo, Mar 3, 2021.

  1. SpyderManToo

    SpyderManToo

    Joined:
    Dec 8, 2020
    Posts:
    387
    in my 2d top down shooter, i want the player to know how the bullets will move when you hold left click, how do i achieve this?
     
  2. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    1,556
    How do the bullets know where to move when the player does fire and what they hit?

    Use that logic to determine where they will land. Of course this only works if they hit instantaneously, i.e. the same frame that you fire. If they travel slowly, you'll need to simulate their travel by simulating multiple frames until they hit.
     
  3. SpyderManToo

    SpyderManToo

    Joined:
    Dec 8, 2020
    Posts:
    387
    o, the bullets are instantiated and arent raycasts soooo, ig i cant do it ;-;