Add method to perform ray casting