NeonRiver
|
  |
| Joined: 12 Feb 2013 |
| Total Posts: 4936 |
|
| |
|
NeonRiver
|
  |
| Joined: 12 Feb 2013 |
| Total Posts: 4936 |
|
| |
|
NeonRiver
|
  |
| Joined: 12 Feb 2013 |
| Total Posts: 4936 |
|
| |
|
NeonRiver
|
  |
| Joined: 12 Feb 2013 |
| Total Posts: 4936 |
|
| |
|
|
| 04 May 2014 04:46 PM |
| You could use a region3 for the police's view? |
|
|
| Report Abuse |
|
|
NeonRiver
|
  |
| Joined: 12 Feb 2013 |
| Total Posts: 4936 |
|
| |
|
NeonRiver
|
  |
| Joined: 12 Feb 2013 |
| Total Posts: 4936 |
|
| |
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 04 May 2014 04:49 PM |
regarding the latter question (more interesting than the former):
the human eyes have an angle of FoV around 95 degrees or .572pi radians. i have drawn here a diagram explaining the math behind this script
imgur dot com slash bRmuKqE.png
(full explanation coming in next post, just posting to let you know i'm here) |
|
|
| Report Abuse |
|
|
NeonRiver
|
  |
| Joined: 12 Feb 2013 |
| Total Posts: 4936 |
|
| |
|
|
| 04 May 2014 04:52 PM |
| You COULD use a region3. Considering you don't even know what one is. |
|
|
| Report Abuse |
|
|
|
| 04 May 2014 04:55 PM |
while wait () do if math.random (10) <3 then humanoid:MoveTo (randompozsitionhere, part) end end |
|
|
| Report Abuse |
|
|
NeonRiver
|
  |
| Joined: 12 Feb 2013 |
| Total Posts: 4936 |
|
| |
|
|
| 04 May 2014 04:55 PM |
| The triangle of the diagram represents the Field of Vision, The blue dot is the police, the red dot is the hitman, the line that connects the two dots is the direct vision of the hitman. |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 04 May 2014 05:04 PM |
we must narrow this objective down to two elements:
- determining whether the police is within proper distance to see the hitman - determining whether the the policeman is at the proper angle to see the person
the rotationless field of vision can be quantified by a circle with radius r. r is the maximum distance you want the police man to be able to see. for this example, let r = 100 studs. the rotational field of vision is quantified by an inscribed polygon (triangle) with an angle of 95 degrees. the radius bisects the triangle, leaving you with two right triangles. let the vertex of the triangle be called point A. this is the position of the policeman. now, let the position of the hitman be called point B. because the vertex angle was bisected, we now have two 47.5 degree angles rather than one 95 degree angle.
we draw a line AB, thus length is the distance between the two points. angle is found by atan2(By-Ay, Bx-Ax) if angle > 47.5 it's not in field of vision
voila. that's efficient as it gets, region3 is idiotic |
|
|
| Report Abuse |
|
|
NeonRiver
|
  |
| Joined: 12 Feb 2013 |
| Total Posts: 4936 |
|
| |
|
NeonRiver
|
  |
| Joined: 12 Feb 2013 |
| Total Posts: 4936 |
|
| |
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 04 May 2014 05:20 PM |
| i gave you everything you need. what's the issue? |
|
|
| Report Abuse |
|
|
NeonRiver
|
  |
| Joined: 12 Feb 2013 |
| Total Posts: 4936 |
|
| |
|
NeonRiver
|
  |
| Joined: 12 Feb 2013 |
| Total Posts: 4936 |
|
| |
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 04 May 2014 11:12 PM |
| i'm pretty sure it's only a few lines of code... |
|
|
| Report Abuse |
|
|
|
| 04 May 2014 11:43 PM |
| First one --- Some RPG kits and zombies(like zombie king model) have this. Second one, call translate. |
|
|
| Report Abuse |
|
|
|
| 04 May 2014 11:48 PM |
50% simple code: function IHaveTheKnifeMotha() workspace:GetChildren() for i,v in pairs do if v.className("Tool") then v.FindFirstChild("KnifePart") --Must have this part on the knife to figure out if it's the freaking knife okay? if v.Parent("Model") then v:GetChildren() if v:FindFirstChild("Handle") then LOL I don't know what's next! |
|
|
| Report Abuse |
|
|
|
| 05 May 2014 01:28 AM |
To test if the police can see the hitman:
local CosTheta=math.cos(95*math.pi/180) if Police.Torso.lookVector:Dot(Police.Torso.Position-Hitman.Knife.Position)>CosTheta then --Police can see Hitman end |
|
|
| Report Abuse |
|
|
|
| 05 May 2014 01:29 AM |
| Whoops, you might also want to throw a raycast in there. |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 05 May 2014 04:02 PM |
my god. i gave him everything there is, and this dude is still looking for answers. and then n00b above wants to use raycast. i'm done, i have no hope for sh |
|
|
| Report Abuse |
|
|