Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Local right direction for raycasting.

Discussion in 'Scripting' started by nutmmm, Feb 18, 2015.

  1. nutmmm

    nutmmm

    Joined:
    Feb 13, 2015
    Posts:
    11
    How do I get A objects local right direction for raycasting it seems this.transform.right still returns world space.
     
  2. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
  3. nutmmm

    nutmmm

    Joined:
    Feb 13, 2015
    Posts:
    11
  4. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,077
    If that's not what you want, I'm not sure what you're really after. An object's right direction is defined in world space. Asking for it in local space is 1,0,0 by definition, no?
     
  5. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,077
    Maybe if you explain what you're trying to do in more detail, someone can help.
     
  6. nutmmm

    nutmmm

    Joined:
    Feb 13, 2015
    Posts:
    11
    ok I have a player (capsule) and I want to check if there is a wall to his right so I use raycast to check this so I start it at his transform and the direction is this.transform.right . but when I debug it points to 1,0,0 not to his right.

    FIXED:

    Just fixed this by adding an empty gameObject on the right side of the player then going:
    emptyObjectSignallingRightPos-playerPos
     
    Last edited: Feb 18, 2015