I got a question..
I'm using raycasting for shooting with the mouse only problem is, that my raycast needs to stop at the mousepointer. The variable for that is "hit.point (Vector3)" or just "hit (RaycastHit)".
Let me explain:
for some reason:
so Physics.Raycast (Vector3,Vector3,float,layerMask) doesn't work, eventhough the reference sais:
Please help me :)
I just made 2 scripts in which 1 calculates the hit.point and gave the distance to the ray2. Now my blue ray (or DVD, lawl) length is the distance between the mouse and the player.
But thanks everyone for thinking ;)
answered May 27 '11 at 10:05 AM
of course you would use however far you would like your ray to go for distance. So if you already have a distance (from another raycast? I dunno why you would need to do more than one) you would use this.
OBJECT most likely being to object you are casting from so you can just use transform.position.
Good Luck TMD
Edit. The picture didn't load before. Try Plane.Raycast. Not sure about the arguments.
Like said before in the comments you can try finding the closes point of two lines as they'll more likely to get close than to intersect. I've found this script on google search. Maybe it'll help you.
answered May 27 '11 at 07:23 AM