Search Unity

Eteeski tutorials

Discussion in 'Scripting' started by aldian, Aug 2, 2012.

  1. aldian

    aldian

    Joined:
    Jul 28, 2012
    Posts:
    32
    In fps 1.1.3 i try to follow everything you say to do,The problem is the bullethole does not appear. all my objects are set up and tagged, i am however using a meshed terrain. Do i need to tag it diffrently?


    I hav no errors at all.




    Code (csharp):
    1. var maxDist: float = 1000000000;
    2. var decalhitWall : GameObject;
    3. var floatInFrontOfWall : float = 0.00001;
    4. function Update ()
    5. {
    6.     var hit : RaycastHit;
    7.     if(Physics.Raycast(transform.position, transform.forward, hit, maxDist))
    8.        
    9.         {
    10.             if (decalhitWall  hit.transform.tag == "Level Parts")
    11.                 Instantiate(decalhitWall, hit.point + (hit.normal * floatInFrontOfWall), Quaternion.LookRotation(hit.normal));
    12.         }
    13.     Destroy(gameObject);
    14. }
     
  2. eteeski

    eteeski

    Joined:
    Feb 2, 2010
    Posts:
    476
    do you have a mesh collider on the terrain?
     
  3. aldian

    aldian

    Joined:
    Jul 28, 2012
    Posts:
    32
    Yes i do - everything is unticked
     
  4. 515Dastan

    515Dastan

    Joined:
    Sep 10, 2012
    Posts:
    1
    Have there been a solution for this issue...?
    Because I have a similar problem about this part,

    My problem is that it seems at some distances (mostly close distances) the Raycast some how doesn't collide with the mesh and leaves its effect on the mesh behind the one it should. Like if there are two walls, it will go through the first one and collide with the one behind and create the bullet whole there!!!