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

Opinons, Line Render Or Collision

Discussion in 'Scripting' started by DanSingh, Jun 1, 2016.

?

Collision Or Line Render

  1. LineRender

    0 vote(s)
    0.0%
  2. Collision

    0 vote(s)
    0.0%
  1. DanSingh

    DanSingh

    Joined:
    Feb 5, 2015
    Posts:
    98
    Greetings,
    I am making an fps game, and I wanted to get opinions and a couple explanations. I am currently working on the shooting mechanics and I have the option to use prefabs and use collisions to detect objects, but I was thinking this might use too much computing power or might not be efficient, option two is that I should use a line render, however with the line render, it lags in its position relative to the gun and if i wanted minimal lag I would have to keep the Line Render on the entire game. So I would like to know what you think? Please state a reason

    Thanks.
     
  2. gorbit99

    gorbit99

    Joined:
    Jul 14, 2015
    Posts:
    1,350
    I didnt relly understand the goal youre trying to reach, but if youre trying to shoot something and detect, what you shot:
    I orefer using raycasts, because its fairly efficient, and user friendly, because they dont have to deal with gravity
    If this wasnt what you meant, then my answee could be incorrect
     
    Kiwasi likes this.
  3. DanSingh

    DanSingh

    Joined:
    Feb 5, 2015
    Posts:
    98
    Well I was trying to use the line render but when I was moving my character around and it's rotation the line render couldn't keep up.
     
  4. gorbit99

    gorbit99

    Joined:
    Jul 14, 2015
    Posts:
    1,350
    I still cant understand, what youre trying to reach with either of those, but maybe Im sliw at 2 pm, could you explain it, what youre planning to do? Shootijg a gun, moving a player, checking if the player is on ground?
     
  5. DanSingh

    DanSingh

    Joined:
    Feb 5, 2015
    Posts:
    98
    shooting a gun sorry I wasn't clear enough
     
  6. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    A line renderer is not going to help with a gun. A line renderer simply draws a line. Appropriate for rendering a lazer beam, but not much else.

    You want to use a Physics.Raycast instead.
     
  7. DanSingh

    DanSingh

    Joined:
    Feb 5, 2015
    Posts:
    98
    Okay Thanks
     
  8. gorbit99

    gorbit99

    Joined:
    Jul 14, 2015
    Posts:
    1,350
    And if you only do, when the trigger is pulled, aka the player pressed something, then it wont use up too many resources