Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Predicting 2d physic trajectory

Discussion in 'Physics' started by vee41, Sep 1, 2016.

  1. vee41

    vee41

    Joined:
    Nov 14, 2013
    Posts:
    32
    Hi,


    I'm looking to draw trajectory for projectile being launched. I'm using 2d physics, my game is topdown space game. So no gravity, perhaps minor drag to slow things overtime, some point affectors to simulate gravity for planets in the scene and no need to predict anything after first collision happens.

    Two ways I've scouted are:

    1. Writing my own prediction formulas, basically trying to simulate what unity is doing.
    2. Shooting invisible placeholder object and tracing it's route to find likely route the actual object will take.

    Cons for these are:
    1. - Upkeep (engine updates might change things)
    - More effort required, might be complex to get right

    2. - Not instant, projectile can take co siderable time to travel

    Any experience/thoughts what approach would work best in my case?