TheKgroup
|
  |
| Joined: 28 Aug 2008 |
| Total Posts: 362 |
|
|
| 16 Sep 2017 09:50 PM |
I've read the wiki 3 times and I honestly am so puzzled. How does raycasting work? Is it something that is done once? Or is constantly ran? How do I create a ray. What are they used for?
Ngroup stole my cookie. |
|
|
| Report Abuse |
|
|
|
| 16 Sep 2017 09:54 PM |
yea the wiki is really bad i remember cntkillme explained it to me then i understood.
have to learned geometry? |
|
|
| Report Abuse |
|
|
Thedagz
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 798 |
|
|
| 16 Sep 2017 09:55 PM |
Think of a ray as a laser pointer
So if you had a laser pointer and you turned it on and point it at a wall, then you know 2 things
The origin of the laser pointer (The position would be the laser pointer)
And the direction of the laser pointer You also know the endpoint but you don't know the specific position of it
Now if something were to walk in front of the laser, the end point would change and you would know who the laser is hitting.. Using the same logic rays are similar
Raycasting generates a ray between the start and end point, You know the origin and the direction of the ray
if you use the function FindPartOnRay(), you would know the specific position the laser is hitting and what part it is hitting
Raycasting is most commonly used for guns, when you shoot a gun it generates a laser-like bullet.
To get the size of the bullet needed you need to raycast and get the length of the ray from Start Position to End Position
To see if you're hitting something you use the FindPartOnRay() function to see if you're hitting anything
If you are hitting something then you can damage that player
Hope this helps
Need Help With scripting or Hire Scripters? Go here! via Discord : discord.gg/rfnudw6 |
|
|
| Report Abuse |
|
|
Vultorz
|
  |
| Joined: 02 Mar 2015 |
| Total Posts: 2985 |
|
| |
|
TheKgroup
|
  |
| Joined: 28 Aug 2008 |
| Total Posts: 362 |
|
|
| 16 Sep 2017 09:57 PM |
Thanks that really helped. If I wanted to find the point on a brick an object is heading how can that be done? Any specific function or way to do this?
Ngroup stole my cookie. |
|
|
| Report Abuse |
|
|
Thedagz
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 798 |
|
|
| 16 Sep 2017 10:00 PM |
| Can you explain a bit more in-depth idk what you mean by a point on a brick heading |
|
|
| Report Abuse |
|
|
TheKgroup
|
  |
| Joined: 28 Aug 2008 |
| Total Posts: 362 |
|
|
| 16 Sep 2017 10:01 PM |
| So what I am making is a hockey game with an artificial intelligence goalie, and i wnt to find the point of where the ball when shot #### #### on a specific brick based on its direction for the goalie to judge where to move his body and limbs. Ngroup stole my cookie. |
|
|
| Report Abuse |
|
|
Thedagz
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 798 |
|
|
| 16 Sep 2017 10:08 PM |
Hmm, I don't think you need raycasting for that
just vector math should do the trick
You might wanna look at dotproduct not sure if that will help you
http://wiki.roblox.com/index.php?title=Dot_product
Need Help With scripting or Hire Scripters? Go here! via Discord : discord.gg/rfnudw6 |
|
|
| Report Abuse |
|
|
TheKgroup
|
  |
| Joined: 28 Aug 2008 |
| Total Posts: 362 |
|
|
| 16 Sep 2017 10:09 PM |
1. That confused the heck out of me 2. The only thing I saw that made sense was :FindPartOnRay()
Ngroup stole my cookie. |
|
|
| Report Abuse |
|
|
Thedagz
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 798 |
|
|
| 16 Sep 2017 10:11 PM |
| yeah the problem your having seems pretty mathy :( |
|
|
| Report Abuse |
|
|
TheKgroup
|
  |
| Joined: 28 Aug 2008 |
| Total Posts: 362 |
|
|
| 16 Sep 2017 10:14 PM |
So I can't use rays to find the position the ball is going? : L
Ngroup stole my cookie. |
|
|
| Report Abuse |
|
|
|
| 16 Sep 2017 10:15 PM |
| yes you can. ############### ############### ############### |
|
|
| Report Abuse |
|
|
|
| 16 Sep 2017 10:16 PM |
| wow roblox censored my siggy, but if you make a value the balls position, wait like .1 seconds, then do something like raycast.new(oldpos,currentpos) or just use velocity. ############### ############### ############### |
|
|
| Report Abuse |
|
|
TheKgroup
|
  |
| Joined: 28 Aug 2008 |
| Total Posts: 362 |
|
|
| 16 Sep 2017 10:17 PM |
The best way if I am still confusing you to describe is. There is a net, and a brick on the goal line. And I want to know where on that brick the ball will touch. And with that I want to have the goalie be able move and save on that. Is there a function or property with rays to do so?
Ngroup stole my cookie. |
|
|
| Report Abuse |
|
|
Thedagz
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 798 |
|
|
| 16 Sep 2017 10:21 PM |
| local Ball = -- Ball local Net = -- Net local ### # ################################################# local Hit,Pos = ###################################################### if Hit == Net then print(Pos) end Need Help With scripting or Hire Scripters? Go here! via Discord : discord.gg/rfnudw6 |
|
|
| Report Abuse |
|
|
Thedagz
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 798 |
|
|
| 16 Sep 2017 10:29 PM |
bastepin *DOT* KOM/HHV7nEb0
replace b with p
replace p with b |
|
|
| Report Abuse |
|
|