Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

First time using Ray Casting, need help. ?

Basically what I'm trying to do is this: Lets say I have a gun that rotates according to the players arm, I want to cast a ray (If it even works this way) from the gun scope and get the point (Or position if you will, similar to mouse.hit) of the intersection. Is this possible? If so, how would I go about coding this? Thanks!

EDIT: Not relying on Mouse.Hit, how do I find out the position of intersection with another part in the direction of the gun scope...

4 comments

0

Judging from your first sentence, you DEFINITELY should try some more simple exercises to better understand Roblox Lua. Although challenging yourself is good, jumping ahead too far will cause you to not really understand the concepts and how everything works. Start at level 1.

0

Thank you, but I already understand all that.

0

I guess I wrote my question wrong. But no experience I meant I had no use for it until now. I understand the fundamentals, but I just want to make sure I can achieve what I want with this method.

1 answer

Yes, this Wiki article covers pretty much everything you need to know about Raycasting. Read carefully. http://wiki.roblox.com/index.php?title=How_to_Make_a_Raycasting_Lasergun

3 comments

0

Lol, that's the exact same article I dissected for hours. Thats what was messing me up, that script was relying on mouse.hit, but mine isnt. So I'm not sure how to tell the script to continue in the direction of the gun scope...

0

Wouldn't your gun's reticle be centered at where the mouse is anyway? There are surely ways to do it, but maybe not with this method.

0

Do you perhaps have any idea how ?

This discussion is preserved as it was. New answers, comments, and votes are closed.