This tutorial may be of use to you. It is for creating a line trace but you could easily modify it to instead shoot bullets or whatever you want.