Search Unity

Trajectory between two points

Discussion in 'Scripting' started by akitsu, Aug 1, 2014.

  1. akitsu

    akitsu

    Joined:
    Nov 26, 2013
    Posts:
    38
    Hello guys / ladies!

    What I'm trying to achieve is lauch object between two points so it'll land given position! Also in my game I'm not using rigidbody physics so I am using basics transform calculations. It would help so much if you could help me tackle this problem. Here is also picture if you don't understand my bad english :D
     

    Attached Files:

  2. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    I have never really looked into this, but there is a recent thread about creating circles via Mathf. Specifically, cos and sin. My thought is, each calculates a sine wave. One on y, one on x.

    However, if you want something more random, and less a pattern, you could apply a constant direction, of Translate() to a transform, until you are content, ie, game ending. This would force the transform down.

    Then, for instance if you click mouse, apply one in another direction. However, once mouse is released, the "gravity" force is applied again.
     
  3. akitsu

    akitsu

    Joined:
    Nov 26, 2013
    Posts:
    38
  4. lrlelaldl

    lrlelaldl

    Joined:
    Jul 27, 2014
    Posts:
    75
    If you are using your own equations for physics you;d only have to run your physics equations til the object were to stop to know where it would stop. as for figuring out how to make it land exactly at a certain spot, that bit is a bit more complicated, and you'd have to pretty much reverse your equations and do the opposite to find the starting forces and what not