generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

[ Content Deleted ]

Previous Thread :: Next Thread 
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
04 May 2014 04:30 PM
[ Content Deleted ]
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
04 May 2014 04:33 PM
[ Content Deleted ]
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
04 May 2014 04:36 PM
[ Content Deleted ]
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
04 May 2014 04:41 PM
[ Content Deleted ]
Report Abuse
ChosenDreamer is not online. ChosenDreamer
Joined: 23 Oct 2013
Total Posts: 15580
04 May 2014 04:46 PM
You could use a region3 for the police's view?
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
04 May 2014 04:48 PM
[ Content Deleted ]
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
04 May 2014 04:49 PM
[ Content Deleted ]
Report Abuse
Absurdism is not online. 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 is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
04 May 2014 04:52 PM
[ Content Deleted ]
Report Abuse
ChosenDreamer is not online. ChosenDreamer
Joined: 23 Oct 2013
Total Posts: 15580
04 May 2014 04:52 PM
You COULD use a region3. Considering you don't even know what one is.
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
04 May 2014 04:55 PM
while wait () do
if math.random (10) <3 then
humanoid:MoveTo (randompozsitionhere, part)
end
end
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
04 May 2014 04:55 PM
[ Content Deleted ]
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
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 is not online. 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 is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
04 May 2014 05:16 PM
[ Content Deleted ]
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
04 May 2014 05:19 PM
[ Content Deleted ]
Report Abuse
Absurdism is not online. 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 is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
04 May 2014 05:21 PM
[ Content Deleted ]
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
04 May 2014 09:56 PM
[ Content Deleted ]
Report Abuse
Absurdism is not online. 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
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
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
DaleMaturingan is not online. DaleMaturingan
Joined: 17 Oct 2012
Total Posts: 1179
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
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
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
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
05 May 2014 01:29 AM
Whoops, you might also want to throw a raycast in there.
Report Abuse
Absurdism is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image