Jump to content
Unity Insider Forum

Raycast Drawray


swat243

Recommended Posts

Hallo Ich habe da so ein Problem mit mein Script ,Ich möchte gerne,das wenn Ich " Fire1" drücke,dass ein grüner Strahl gezeigt wird.

 

 

Hier mein Script:

 

using UnityEngine;

using System.Collections;

 

public class RayColor : MonoBehaviour {

 

// Use this for initialization

void Start () {

 

}

 

public Ray strahl;

public RaycastHit schlag;

 

void Update () {

strahl.origin = transform.position;

strahl.direction = transform.TransformDirection (Vector3.forward);

if (Input.GetButton ("Fire1"))

 

if (Physics.Raycast (strahl, out schlag, 9))

Debug.DrawRay (strahl ,Color.green);

}

}

Link zu diesem Kommentar
Auf anderen Seiten teilen

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Auf dieses Thema antworten...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Lädt...
×
×
  • Neu erstellen...