1WOOF1
|
  |
| Joined: 03 May 2009 |
| Total Posts: 20682 |
|
| |
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
| |
|
1WOOF1
|
  |
| Joined: 03 May 2009 |
| Total Posts: 20682 |
|
| |
|
|
| 30 Sep 2011 01:34 PM |
| Just check if the magnitude is 1 |
|
|
| Report Abuse |
|
|
1WOOF1
|
  |
| Joined: 03 May 2009 |
| Total Posts: 20682 |
|
| |
|
|
| 30 Sep 2011 01:37 PM |
Oh wow thanks :P I misread it sorry.
It depends on the size of the brick. So I think you can use it like this:
if (BRICK.Position - CHAR.Torso.Position).magnitude == (BRICK.Size).unit then |
|
|
| Report Abuse |
|
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 30 Sep 2011 01:42 PM |
| Use less than, rather than equal to. Also, you would do a magnitude of half of the largest axis. |
|
|
| Report Abuse |
|
|
| |
|
|
| 30 Sep 2011 02:01 PM |
It's not as simple as that, either.
function checkIfPlayerTouching(player, brick) local pPos = player.Character~=nil and player.Character.Torso.Position local bPos = brick.Position local bSize = brick.Size -- Here's where it gets complicated! if math.abs(pPos.x-bPos.x)<(bSize.x/2+1) and math.abs(pPos.z-bPos.z)<(bSize.z/2+1) and (pPos.y-bPos.y)<=(bSize.y/2+3) then
-- player is in contact with brick
end end |
|
|
| Report Abuse |
|
|
|
| 30 Sep 2011 03:14 PM |
My friend created something like this:
http://www.roblox.com/While-Touched-Button-V1-0-item?id=35740461 |
|
|
| Report Abuse |
|
|