Search Unity

Facing

Discussion in 'Scripting' started by HalDevOne, Aug 20, 2018.

  1. HalDevOne

    HalDevOne

    Joined:
    Apr 12, 2014
    Posts:
    67
    Hello!

    I feel llike this is a simple question but anyhow.
    I want to play my tree falling animations depending on what side of tree my player is. So how do i get to know what side of the tree my player is? Also my trees have random rotation but that should not matter. It doesnt have to but super precise.
     
  2. Doug_B

    Doug_B

    Joined:
    Jun 4, 2017
    Posts:
    1,596
  3. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,770
    If rotation is irrelevant, simply calculate position difference, between tree and your object. You get direction vector. You can optionally normalize it.
     
  4. HalDevOne

    HalDevOne

    Joined:
    Apr 12, 2014
    Posts:
    67
    Doug_B likes this.