Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

First time using Ray Casting, need help. ?

Asked by 9 years ago

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...

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. Perci1 4988 — 9y
0
Some questions about raycasting are answered here: https://scriptinghelpers.org/questions/8503/can-someone-answer-these-raycasting-questions Perci1 4988 — 9y
0
Thank you, but I already understand all that. Orlando777 315 — 9y
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. Orlando777 315 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

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

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... Orlando777 315 — 9y
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. SlickPwner 534 — 9y
0
Do you perhaps have any idea how ? Orlando777 315 — 9y
Ad

Answer this question