Search Unity

I need help with casting multiple raycasts, please

Discussion in 'Physics' started by PhoenixRising1, Sep 18, 2015.

  1. PhoenixRising1

    PhoenixRising1

    Joined:
    Sep 12, 2015
    Posts:
    488
    I understand how to cast one, it's not that hard :p. But for my game I want to cast 3, with the other 2 being slightly adjusted to the left and right respectively.

    Edit: I figured it out thanks to the awesome forums here :).


    issuerTransformArray[0] = GameObject.Find(rayIssuer).GetComponent<Transform>();


    issuerTransformArray[1] = Quaternion.Euler(0, -45, 0) * issuerTransformArray[0];
     
    Last edited: Sep 18, 2015
  2. holliebuckets

    holliebuckets

    Moderator

    Joined:
    Oct 23, 2014
    Posts:
    496
    Quick question: What if you could give them an endpoint? Would that work for you??? If it does, then you wouldn't need to worry about rotation :D

    I have a personal (not Unity official) short tutorial on Linecasts :) The video is less than 5 mins and there is a full transcript on the blog. Otherwise if you would like to learn more about Euler's Angles and Quaternions this video is an awesome resource!! It really helped me get a solid grasp of them when I wanted a foundational understanding :D Hope that helps and best of luck!!!
     
    PhoenixRising1 likes this.
  3. PhoenixRising1

    PhoenixRising1

    Joined:
    Sep 12, 2015
    Posts:
    488
    Thanks a lot for the reply :). I actually understand it a lot better after that last video :). Thanks again.
     
    Last edited: Sep 18, 2015
    holliebuckets likes this.