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

Rigidbody trajectory direction at fixed velocity

Discussion in 'Scripting' started by CGPepper, Jun 9, 2017.

  1. CGPepper

    CGPepper

    Joined:
    Jan 28, 2013
    Posts:
    151

    I have a 3D cannon that moves all over the map and fires a projectile at a fixed point. The projectile is a rigidbody. I have a starting point and the desired destination point. Starting velocity is known.
    How do i calculate the trajectory vector that i can apply to the velocity to reach the target? Because of the nature of rigidbody, can the calculation even be done with precision?

    Any help would be greatly appreciated.
     
    Last edited: Jun 10, 2017
  2. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,010
    It's quite possible to calculate anything as long as you have enough data.

    What do you mean by 'velocity is fixed'? With respect to what? If you fired it straight up would it keep going at a fixed velocity?
     
  3. CGPepper

    CGPepper

    Joined:
    Jan 28, 2013
    Posts:
    151
    Yes sorry, the starting velocity is fixed / known
     
  4. Laperen

    Laperen

    Joined:
    Feb 1, 2016
    Posts:
    1,065
    Are you familiar with "projectile motion", a topic under physics. Yes I do mean academically.
     
  5. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,010