Hi, I'm making a game where you can pick up and move objects when an object is placed in front of them. This object has a raycast attached which enables the movement script when it finds a moveable object. However, the Ray travels forwards in terms of game position, which means when you play the game, you actually have to be slightly left or right of the object for the ray to hit, which isnt very intuitive.
So basically, I want to shoot a ray forward from the object whilst moving forward in terms of the screen position. It needs to start from the object, not the camera.
I think I can do this with Camera.WorldToScreenPoint, but, being completely honest, after trying several different ways, I figured I honestly have no idea how to use that code. Can anyone help me figure it out?
Here's the Raycasting portions of my script, although it's pretty standard:
asked Mar 11 '11 at 08:07 PM
You can store Camera.main in start if you prefer, so you don't need to look it up every time