phoniex
|
  |
| Joined: 03 Feb 2008 |
| Total Posts: 34985 |
|
|
| 07 Apr 2013 09:03 AM |
Is it possible to make a script that detects when a player is under a block that is shielding them from the sky?
~Rock is dead. Long live paper and scissors!~ |
|
|
| Report Abuse |
|
|
|
| 07 Apr 2013 09:11 AM |
put a cancollidable brick unther the brick shielding him from the sky and then check if the player is touching that brick
~Life has two keys to success one of them is patience the other one is under the carpet infront of my doorstep. |
|
|
| Report Abuse |
|
|
|
| 07 Apr 2013 09:11 AM |
reply if you understand it or not please
~Life has two keys to success one of them is patience the other one is under the carpet infront of my doorstep. |
|
|
| Report Abuse |
|
|
phoniex
|
  |
| Joined: 03 Feb 2008 |
| Total Posts: 34985 |
|
|
| 07 Apr 2013 09:12 AM |
That won't work for what I have in mind
~Rock is dead. Long live paper and scissors!~ |
|
|
| Report Abuse |
|
|
|
| 07 Apr 2013 09:22 AM |
and what is it that you have in mind?>
~Life has two keys to success one of them is patience the other one is under the carpet infront of my doorstep. |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 07 Apr 2013 09:24 AM |
Use Magnitude on a part in the middle of the 'room'. If the player is within a distance, then consider him under shelter.
You could also use Region3, with the house as the Ignore list. |
|
|
| Report Abuse |
|
|
|
| 07 Apr 2013 09:30 AM |
| Probably a really inefficient/stupid way of doing it, but you could raycast up from the head and see if it hits blocks (that aren't hats, just in case). |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 07 Apr 2013 09:34 AM |
That would actually be a better way than magnitude/Region3.
You would raycast from the head's position going up, and if there's a part named 'shelter' above it, consider the player under shelter. |
|
|
| Report Abuse |
|
|
|
| 07 Apr 2013 09:35 AM |
@Dig,
Yay, my suggestion was useful. =) |
|
|
| Report Abuse |
|
|
phoniex
|
  |
| Joined: 03 Feb 2008 |
| Total Posts: 34985 |
|
|
| 07 Apr 2013 09:40 AM |
Thanks, guys
~Rock is dead. Long live paper and scissors!~ |
|
|
| Report Abuse |
|
|
tyzone
|
  |
| Joined: 16 Aug 2008 |
| Total Posts: 1726 |
|
|
| 07 Apr 2013 09:45 AM |
Make sure the raycast has nothing to do with the Head's lookVector, and works with the actual and, eh, "global" Y axis. Because if the player trips, the raycast would fly around and probably hit the floor a few times.
That would be an useful script. You could make a GUI with snow animation, for instance, that fades out when you're in a shelter. Also, if you add parts like a metal grid above the person (where there's a brick above them, but they're not really under shelter), then I would suggest giving the "Shelter Roof" parts a specific name, and making the script return the name of the brick to make sure it should work. Because yeah, it would also make you be "under shelter" if someone standed on your head, then. |
|
|
| Report Abuse |
|
|