|
| 11 May 2015 02:04 PM |
The only stuff i can find is people making guns.
Could any of you guys give me an example of creating a ray by, starting it from a parts position and sending it to another parts position, or just send the ray out of the part? |
|
|
| Report Abuse |
|
|
| |
|
|
| 11 May 2015 02:07 PM |
I'm pretty sure it's as simple as can be.
origin = Vector3.new() or Part.CFrame.p direction = Vector3.new().unit or Part.CFrame.lookVector ray = Ray.new(origin, direction) --Ray manipulation |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 11 May 2015 02:07 PM |
| Direction is end-start. That should solve that riddle |
|
|
| Report Abuse |
|
|
|
| 11 May 2015 02:13 PM |
| How to check if something hits the ray? |
|
|
| Report Abuse |
|
|
|
| 11 May 2015 02:14 PM |
| Do you use :FindPartOnRay ? |
|
|
| Report Abuse |
|
|
|
| 11 May 2015 02:15 PM |
So lets say you sent the ray from one part to the other and something happened to get between the ray?
How would you print the name of what hit the ray? |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 11 May 2015 02:16 PM |
Workspace:FindPartOnRay(Ray RayToFind, Instance Ignore) -> Instance ?Part, Vector3 ?Location, NormalId ?Surface
Last I heard |
|
|
| Report Abuse |
|
|
|
| 11 May 2015 02:19 PM |
Yes.
game.Workspace:FindRayOnPart(ray) will return the part hit and position it hit the part as a vector3. so... obj, position = game.Workspace:FindPartOnRay(ray) then you can make it ignore with FindPartOnRay but only 1 'model' and it's descendants. obj, position = game.Workspace:FindPartOnRay(ray, game.Workspace.Player1) to ignore multiple 'models' just use FindPartOnRayWithIgnoreList obj, position = game.Workspace:FindPartOnRayWithIgnoreList(ray, { game.Workspace.Player1, game.Workspace.Player2 }
hope this helped at all. |
|
|
| Report Abuse |
|
|
|
| 11 May 2015 02:23 PM |
Wish there was a good video explaining ray casting but Thank you all for your help.
|
|
|
| Report Abuse |
|
|