Search Unity

Trajectory and power line

Discussion in '2D' started by SamVorst, Dec 3, 2019.

  1. SamVorst

    SamVorst

    Joined:
    Nov 28, 2019
    Posts:
    19
    Hi, i would like to make a power line and a trajectory line to a object like in the image. But I have no idea how to do it... I'm very new to C#.

    thanks Sam
     

    Attached Files:

  2. Cornysam

    Cornysam

    Joined:
    Feb 8, 2018
    Posts:
    164
    Being very new to C# and Unity, I recommend getting really good at Google. First thing i did was Google something to what you asked and found 3 videos on what you are trying to do.



    I recommend starting with C# and Unity with video tutorials either from Unity themselves or off of YouTube.
     
  3. SamVorst

    SamVorst

    Joined:
    Nov 28, 2019
    Posts:
    19
    Yes, i have looked around on the web for this and seen this tutorial too, only for me it wasn't the solution.

    Do you have any other tips?
     
  4. Cornysam

    Cornysam

    Joined:
    Feb 8, 2018
    Posts:
    164
    Sam, my only other tip is to try and break down your issue into tiny parts. This will help immensely with game development and programming.

    So, you are trying to make a power line and trajectory line:
    -This "Power Line" could be a lot of things. A bar that fills up displaying the "power" level or even an arrow that grows the longer you hold a button or whatever. This could be an animation.
    -To determine this Power, for example, if you hold a button then a float (your power) increases each frame that the button is held until a max limit (if there is one) or something like that.
    -For the trajectory line, I am really not sure but there are tons of videos on it. But i believe you are calculating the angle and have that being displayed. I think there is a mini golf game tutorial that may have a similar mechanic.

    The more you can break this down the easier it will be to Google small, broad problems instead of a specific one.
     
  5. MisterSkitz

    MisterSkitz

    Joined:
    Sep 2, 2015
    Posts:
    776
    You can easily achieve this with particle effects. You simply set a trail and the lifetime determines how long the trail will be. Really easy and also one of my first things I learned when playing with particles. You can add a little noise to make it a little more unique and interesting. Takes approx 5 - 10 minutes to do.
     
    Cornysam and vakabaka like this.
  6. vakabaka

    vakabaka

    Joined:
    Jul 21, 2014
    Posts:
    1,150
  7. SamVorst

    SamVorst

    Joined:
    Nov 28, 2019
    Posts:
    19
    Thanks! That tip is very helpfull! I'm gonna try it!
     
    MisterSkitz likes this.