| |
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
|
| 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 |
|
|
| |
|
| |
|
| |
|
|
| 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 |
|
|
|
| 26 Aug 2014 08:11 AM |
| I think that this would be best accomplished with the .touched and .touchended events |
|
|
| Report Abuse |
|
|
| |
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 26 Aug 2014 08:58 AM |
| Yeah but that can be complicated. |
|
|
| Report Abuse |
|
|