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

simpla raycast problem

Discussion in 'Scripting' started by begger, Oct 4, 2014.

?

is it hard to solve

  1. No

    0 vote(s)
    0.0%
  2. OF COURSE IT IS

    0 vote(s)
    0.0%
  1. begger

    begger

    Joined:
    Oct 4, 2014
    Posts:
    4
    Hey for the first time in my whole Unity advanture i try to use RayCast

    The problem is that i dont see any ray in my scene.. the script iss added to right object
    what should I use:
    var ray=new Ray or Ray ray=new Ray??

    Code (JavaScript):
    1. #pragma strict
    2.  
    3.  
    4. function Start () {
    5.  
    6. }
    7. function Update(){
    8. var ray=new Ray(transform.position,transform.up);
    9. Debug.DrawRay (ray.origin, ray.direction * 1000, Color.green);
    10.  
    11. }
     
  2. aoe_labs

    aoe_labs

    Joined:
    Nov 4, 2013
    Posts:
    42
  3. begger

    begger

    Joined:
    Oct 4, 2014
    Posts:
    4
    ohhhh ,didt know that its only visable during play mode ..yeah it works .thx a lot:)