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 » Scripters
Home Search
 

Best method

Previous Thread :: Next Thread 
ColdRBLX is not online. ColdRBLX
Joined: 25 Jan 2010
Total Posts: 2446
04 Jul 2016 01:33 AM
What should be used in order to detect if a player is within 10 suds of the top side of a block, so if they are on top of the block it will detect them up to 10 suds above it? But if they are off the block then it won't do anything.
Report Abuse
iJacobness is not online. iJacobness
Joined: 20 Jan 2014
Total Posts: 4944
04 Jul 2016 01:38 AM
magnitude, torso.Changed


r+://393244197r+://393244224r+://393244262
Report Abuse
ColdRBLX is not online. ColdRBLX
Joined: 25 Jan 2010
Total Posts: 2446
04 Jul 2016 02:16 AM
how so?
Report Abuse
Haxelgem is not online. Haxelgem
Joined: 18 Jul 2009
Total Posts: 67
04 Jul 2016 03:04 AM
Given a point to test (perhaps the torso's position), try something like this:

function TestPoint(point, part)
if (point.x < part.Position.x - part.Size.x / 2) or (point.x > part.Position.x + part.Size.x / 2) or (point.z < part.Position.z - part.Size.z / 2) or (point.z > part.Position.z + part.Size.z / 2)
return false
return (point.y > part.Position.y) and (point.y < part.Position.y + 10)
end

The first if statement checks whether the test point is within the size / 2 of the center of the part. Since the position of a part is the center, the distance to the boundary is equal to the size / 2.

The second returns true if the test point is above the part and below 10 studs above.

This code assumes that the part is facing upwards, and is axis aligned. If that's not the case, let me know and I can revise. I also haven't tested this, so let me know if there's any issues.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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