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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Drawing Ray

Discussion in 'Scripting' started by Shonysky, Jun 7, 2015.

  1. Shonysky

    Shonysky

    Joined:
    Mar 29, 2014
    Posts:
    44
    Hello, im trying to draw a ray with a cube that i already have inside the prefabs.
    The problem is, i can't set the rotation, the line of the shot (cube of the prefabs) always point to the same direction.
    I have already tried to set the rotation of the line to be the rotation of the camera (my camera rotate with the mouse move), but that also didn't worked.
    Please, help me...

    Code (CSharp):
    1. else
    2. {
    3.     shotline.transform.localScale = new Vector3 (0.025f, 0.025f, maxDistance);
    4.     shotline.transform.position = new Vector3 (shot.origin.x, shot.origin.y,         shot.origin.z+shotline.transform.localScale.z/2);
    5. }
     
  2. Shonysky

    Shonysky

    Joined:
    Mar 29, 2014
    Posts:
    44
    Bump... :c
    Please, help me...
     
  3. Shonysky

    Shonysky

    Joined:
    Mar 29, 2014
    Posts:
    44
    Bump...
     
  4. Shonysky

    Shonysky

    Joined:
    Mar 29, 2014
    Posts:
    44
    No one knows???????????
     
  5. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    draw a ray for debugging purposes?
     
  6. Shonysky

    Shonysky

    Joined:
    Mar 29, 2014
    Posts:
    44
  7. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    Debug.DrawRay
     
    Iron-Warrior likes this.