Search Unity

Projecting a line in direction of travel

Discussion in 'Scripting' started by Genkidevelopment, Mar 2, 2015.

  1. Genkidevelopment

    Genkidevelopment

    Joined:
    Jan 2, 2015
    Posts:
    186
    I want to project a line from a moving object in the direction of travel (For the purpose of alerting other objects that will want to intercept it).

    Other objects need to be aware of the position of this line...

    How might I go about this? If I need to further explain the situation, please say.

    Thanks

    Peace
     
  2. Genkidevelopment

    Genkidevelopment

    Joined:
    Jan 2, 2015
    Posts:
    186
    Ok, so I thought I'd resolve the post by explaining my solution...

    I will project various game objects in front of the projectile at differing timesteps... 0.1s, 0.25s, 0.5s etc...

    These will be placed at the future position (basic vector match and drag modifier).

    When an object wants to intercept the projectile, it asks itself... can I get to position 0.1s in 0.1s? if yes, then by all means, move along to pos 0.1s, if not, how about position 0.25s in 0.25s etc etc...

    Looks realistic as hell ;) Could even implement into a non linear graph for absolute precision :D
     
  3. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    well, the direction of travel is transform.forward

    as for the rest of what you said... I've got no idea what you're talking about.
     
  4. Genkidevelopment

    Genkidevelopment

    Joined:
    Jan 2, 2015
    Posts:
    186
    I needed a way of objects deciding if they can reach a projectile to intercept it... Thus I needed a line in front of the projectile that the other objects could look to move towards, as in, predicting where the projectile will be in x amount of time, ready to catch it ;)
     
  5. Genkidevelopment

    Genkidevelopment

    Joined:
    Jan 2, 2015
    Posts:
    186
    What if I am moving sideways? :D
     
  6. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    are you a crab?
     
    ThermalFusion likes this.