ScriptOn
|
  |
| Joined: 22 Aug 2010 |
| Total Posts: 10885 |
|
|
| 27 Dec 2013 10:31 AM |
Suppose I wanted to see if a raycast could reach another object without hitting it, but only within certain field of view. Like this: twitter.com/ScriptOnRoblox/status/416606961568710657/photo/1
Sorry if twitter links aren't allowed, but I don't know how else to show it.
Any ideas? |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2013 10:32 AM |
"without hitting it"
Isn't that what you need to do to see if it's within range? |
|
|
| Report Abuse |
|
|
ScriptOn
|
  |
| Joined: 22 Aug 2010 |
| Total Posts: 10885 |
|
|
| 27 Dec 2013 10:34 AM |
Its for a claymore script.
I want the center of the claymore to only blow up if:
A. There is a person within its field of view B. They are close enough C. Nothing is in between them |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2013 10:35 AM |
Ray.new(start, (lookAt - start).unit*range)
try that |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2013 10:37 AM |
| Then use FindPartOnRay to check if there is anything between the start and the lookAt (lookAt = the player, I think). Remember, FindPartOnRay gets the FIRST part to hit the ray, so if it's not the player, there's something in between. |
|
|
| Report Abuse |
|
|
ScriptOn
|
  |
| Joined: 22 Aug 2010 |
| Total Posts: 10885 |
|
|
| 27 Dec 2013 10:46 AM |
| evolve, all that "range" thing does is set the max distance of the ray, not the angles it can go by. |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2013 10:47 AM |
| Oh, well then send a bunch of angled rays. |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2013 10:49 AM |
http://wiki.roblox.com/index.php/CFrame#Methods
Use some of these to rotate object stuff to world stuff (or maybe the other way around?) and then do a bunch of adding and subtracting. |
|
|
| Report Abuse |
|
|
ScriptOn
|
  |
| Joined: 22 Aug 2010 |
| Total Posts: 10885 |
|
|
| 27 Dec 2013 10:50 AM |
lol no, but thanks anyways.
I think what I`m going to do is clone the part that is facing the object, then put the clones CFrame as the rays, and check the parts rotation.X against the original Rotation.X. If the difference is over 30, then cancel firing. >:D |
|
|
| Report Abuse |
|
|