Need some explinations for raycasts and decals

I know this is something i should know but i looked everywhere on google and i need someone to simply explain what a decal is refering to and what its used for, and also how do i use raycast for say like a bullet.

Hey Travis,

I can explain raycasting, but I don't know what a decal is either... raycasting is basically a lazer, and when something (Or someone) crosses it, it can trigger something to happen. If you want a actual example, please just let me know.

-Edit-

Here is a script I have that checks the distance between the ground and "you"...

    //Written by/for Gibson Bethke

var Counter : float = 0.0;
var maxCounter : int = 0;
var terrain : Terrain;
var Player : Transform;
var Guitext : Transform;

function Update () {

        var up = Player.TransformDirection (Vector3.up);
        var hit : RaycastHit;
        Debug.DrawRay(transform.position, -up * 5000, Color.green);

        if(Physics.Raycast(Player.position, -up, hit, Mathf.Infinity)){
            Counter = Vector3.Distance(Player.position, hit.point);

            if (Counter > maxCounter) maxCounter = Counter;

            if(Counter <= 10){
                Guitext.guiText.text = "You're at ground level    Top Height: " +maxCounter;

            }else{
                Guitext.guiText.text = Counter+ " Meters";

                if(Counter >= 10){
                    Guitext.guiText.text = Counter+ " Meters       Top Height:   " +maxCounter+ " m";
                }
            }
        }
    }

-Hope I Helped, Gibson

P.s. Sorry, I'm not very good at adding comments into scripts, so I'll explain it...

These are all the variables, You don't need this many, I just like variables, and being able to change things without going into the script.

var Counter : float = 0.0;
var maxCounter : int = 0;
var terrain : Terrain;
var Player : Transform;
var Guitext : Transform;

This means Run Every Frame, so by saying this, I am telling the script to run every frame that the game is running (I know you know some of these things, but incase someone else reads this, it might be helpful)

function Update () {

Now, I'm declaring a variable in this function, so only the script uses it... The variable is "up", which I defined as the direction...

var up = Player.TransformDirection (Vector3.up);

This line is simple... It defines "hit" as when something crosses the "lazer"...

var hit : RaycastHit;

This line is not necessary... All it does is tell Unity to display a line in the scene view... The "* 5000" is just telling it how long the line should be... (You can see were using the "up" variable we set up earlier)

Debug.DrawRay(transform.position, -up * 5000, Color.green);

Now were getting into the more serious stuff... The first thing that this line does is check if the conditions are met... Then, if its true, it fires the "lazer" (Ray) negative "up", or down... Then it tells the distance to Counter (The variable).

 if(Physics.Raycast(Player.position, -up, hit, Mathf.Infinity)){
 Counter = Vector3.Distance(Player.position, hit.point);

For some reason, I find this line funny... Thats probably not a good thing... Anyway, this line checks if Counter (A Variable) is bigger than maxCounter (Another variable)... If it is, maxCounter becomes Counter (Thus setting the high score)...

if (Counter > maxCounter) maxCounter = Counter;

The next line is similar to the previous line... It checks if counter is smaller than 10 (Other than checking if its greater than maxCounter)... If Counter is smaller than 10, Guitext (A variable) is told to say, "You're at ground level" Then display the Top Height (A variable, like a high score)

if(Counter <= 10){
            Guitext.guiText.text = "You're at ground level    Top Height: " +maxCounter;

Here's something we haven't covered yet... "}else{"... It means that if the requirements are not met (if statements are false), "this" happens... And all the this line does is display Counter (The variable) and say meters, as long as your not at "Ground Level"...

}else{
            Guitext.guiText.text = Counter+ " Meters";

And finely, the last line... This one tells you what height your at, as long as your above 10...

if(Counter >= 10){
                Guitext.guiText.text = Counter+ " Meters       Top Height:   " +maxCounter+ " m";

If you have any other questions, please feel free to ask!

-Hope I helped, Gibson

decals are basically temporary textyres triggerd by an event such as bullets hitting a surface wich would create bullet holes, the bullet hole textyre is applied to therever the bullet hit, there are a few ways to do it, but they look the same. it just affects the performance if u pick the most graphic intensive or script intensive it will be un balanced try to balance them to hace better effect. hope this helped

Thanks That is alot of help im just trying to learn a bit more about programming before i start college for it. That comfirmed my theory about raycasting an example would be great. like say a raycast coming out of a gun to save on poly's or maybe like a trigger to run an application to load a level. thx :)