So I followed the instructions step by step and compared my script with yours, but the ray keeps pointing down instead of ...

So I followed the instructions step by step and compared my script with yours, but the ray keeps pointing down instead of forward? I don't know whay I'm doing wrong, is something I need to change on the camera object maybe? Like when you apply rotation or scale after modifying an object on blender? Here are the picture of my problem: http://imgur.com/a/KqYFf
  • Jonathan Gonzalez(jgonzalez) replied

    The script looks to be fine. If you shoot do the bullet holes appear where the raycast is pointing or are they being shot directly onto the wall in front of you? The debug.drawray can be positioned differently than the actual raycast so it's worth testing out to see if it's just the drawray having issues or the actual raycast. 

    You can create another game object in place of the camera and apply the script there to see if the raycast is having issue with the camera or if it’s just a script issue.

    Also, it's hard to tell, but make sure this is applied to the camera and that it's not rotated. It doesn't look like it's rotated, but I also don't know if the script is applied to the camera. If all else fails just re-create the camera and apply the script again. 

  • Felix Macias(amacias2012) replied
    Yes the script is applied to the camera. So I tried continuing with the exercise and added the decals and the bullet holes are actually showing up on the wall in front the mesh despite what the debug.drawray shows, weird, no mater what object I attach the script too, the ray doesn't display properly, it is really strange. http://imgur.com/a/nTz70
  • Jonathan Gonzalez(jgonzalez) replied
    One thing I did notice when looking at your script again is that you're using "DrawLine" instead of "DrawRay", they work a bit differently so that may be the reason why it appears that way. Use "DrawRay" and it should fix the issue. Either way the raycast is working properly, DrawRay is just for debugging purposes.
  • Felix Macias(amacias2012) replied
    Yeah that was it. Thank you.