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

Dot product and angles (math/trig question)

Discussion in 'Scripting' started by giraffe1, Jun 30, 2021.

  1. giraffe1

    giraffe1

    Joined:
    Nov 1, 2014
    Posts:
    300
    Hi,

    This chart https://chortle.ccsu.edu/vectorlessons/vch09/vch09_6.html shows some dot products and their corresponding angle.

    How can I calculate the dot product from the angle? If my agent's field of view is 160 degrees. How can I calculate the dot product of 160/2?

    I couldn't find any info on this. Any help appreciated.

    Thanks.
     
  2. Epsilon_Delta

    Epsilon_Delta

    Joined:
    Mar 14, 2018
    Posts:
    257
    Dot product of unit vectors is just a cosinus of the angle between them. So if you have the angle 160/2 = 80 (degrees?) than the dot product is cos(80) = 0.17364817766.
    You can get more information on wikipedia, but it's a little bit overwhelming, so I suggest you to google something like "dot product explained".
     
    giraffe1 likes this.