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
 

Re: Check if player is currently inside/touching a object?

Previous Thread :: Next Thread 
Badfitz100 is not online. Badfitz100
Joined: 03 Nov 2010
Total Posts: 12591
26 Aug 2014 07:37 AM
[ Content Deleted ]
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
26 Aug 2014 07:53 AM
Well this is both complex and simple


You could either draw a region three the size of the part, than check whats inside.

Or you could do some math to compare if the person is in the box.

Or you could use magnitude(which is simple with circles).



local averagedis= part.Position.X+part.Position.Y+part.Position.Z/3
if (plr.Position - Part.Position).Magnitude < averagedis then
print("hi")
end
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
26 Aug 2014 07:54 AM
oops.


local averagedis= part.Size.X+part.Size.Y+part.Size.Z/3
if (plr.Position - Part.Position).Magnitude < averagedis then
print("hi")
end
Report Abuse
Badfitz100 is not online. Badfitz100
Joined: 03 Nov 2010
Total Posts: 12591
26 Aug 2014 07:55 AM
[ Content Deleted ]
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
26 Aug 2014 07:59 AM
If "Grass" is short and long, I dont recommend using the magnitude way it wont work to well.
Report Abuse
Badfitz100 is not online. Badfitz100
Joined: 03 Nov 2010
Total Posts: 12591
26 Aug 2014 08:00 AM
[ Content Deleted ]
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
26 Aug 2014 08:00 AM
Dont use it.
Report Abuse
Badfitz100 is not online. Badfitz100
Joined: 03 Nov 2010
Total Posts: 12591
26 Aug 2014 08:08 AM
[ Content Deleted ]
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
26 Aug 2014 08:10 AM
local start_point = Vector3.new(g.Position.X,g.Position.Y,g.Position.Z)
local end_point = Vector3.new(-g.Position.X,-g.Position.Y,-g.Position.Z)
local region=Region3.new(start_point,end_Point)


I'm not sure if I made it right check the wiki
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
26 Aug 2014 08:11 AM
I think that this would be best accomplished with the .touched and .touchended events
Report Abuse
Badfitz100 is not online. Badfitz100
Joined: 03 Nov 2010
Total Posts: 12591
26 Aug 2014 08:14 AM
[ Content Deleted ]
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
26 Aug 2014 08:47 AM
pokemon is stupid and you should find something to do with your life instead of wasting money on something that doesnt make anyone happy but yourself, and in a few years you will regret buying them.
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
26 Aug 2014 08:49 AM
That conversation took an interesting turn.

anyways, will you not just have a grid of grass and using the touched event see when they enter a new grass grid spot?
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
26 Aug 2014 08:51 AM
He said something like pokemon so I don't know if I should still help him, or if he is making another crappy pokemon game.
Report Abuse
iIikeyou is not online. iIikeyou
Joined: 07 Mar 2012
Total Posts: 1659
26 Aug 2014 08:53 AM
Do not use Region3. The actual solution to this is quite a bit more complicated; as when parts are rotated a Region3 will stay true to it's normal direction and include more space than the actual part takes up.

In order to calculate the distance a Part's size goes in a specific direction up to it's corner requires detecting the normal direction it is applying to that size Vector3 from both parts in opposite directions, then subtract. If it's a negative number or 0, they are touching/inside of eachother.

GL with that math
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
26 Aug 2014 08:58 AM
Yeah but that can be complicated.
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