Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

SurfaceFace Detection, making a one way door? [closed]

Asked by 6 years ago

Excuse the poor title, the website wouldn't allow my other ones.

I wish to make a one way door, however I haven't been able to detect which face of the door is the one getting touched. Dunno if its even possible. Any ideas on how to do it?

I need the door to consist on a single part, however. Also, the script needs to work with the door changing its position frecuently. This is because I intend of having my one way door as an avaible part for building in my building place, for what players would need to be able to grab it around freely.

Thanks beforehand.

Closed as Not Constructive by theCJarmy7, LateralLace, Leamir, cabbler, and minikitkat

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
1
Answered by
T0XN 276 Moderation Voter
6 years ago
Edited 6 years ago

Hello tiraner300,

Interesting question! The ideas I've come up with probably aren't the best way of doing this, but I believe they will get the result you want.

1) Place invisible parts behind and in front of the door so that each part has the same length and width of the door and they are placed so that they touch each side of the door. When the part in front of the door is touched, you will use that as a method of knowing when to open the door. The part on the back side of the door will be used as a method of knowing when to close it when it is touched by the player.

If my explanation didn't really help, then here's an image.

2) Either that, or you could go for a more complex method (which will probably work better). When the player touches the door, and then stops touching it- in other words they have passed through the door -then close it. Make use of the direction the player is facing in relation to the door in order to make sure that the player simply didn't touch the door then walk in the opposite direction.

EDIT: I realize what you're looking for now, so thank you for those images. Unfortunately, I am unable to think of an exact solution to solve your problem, but I think I know where you can start. Try taking a look at the surface input properties of a part to detect which side of the door is which. The solution won't be easy, but I'm sure its possible to accomplish your goal of using only one part. Cheers mate, and good luck!

0
Sorry I had to leave my reply to you in a new answer to this thread, the comment section was to short for all I had to say :P. Le_Teapots 913 — 6y
0
Thanks man, will have a look at the link you sent me. Cheers! Le_Teapots 913 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

@TOXN

Thanks for the reply, both of your suggestions are interesting. The first one unfortunately is not going to work for me since, for the reason given in my question, I want the whole mechanism to be built into a single brick. The second one however looks more promising according to my specifications, however there's something about it I don't quite understand.

Once the player goes through the door, it closes to prevent them from coming right through it again from the direction they exited; this, however, would mean they will also not be able to go through the direction they are meant to be able to. My explanaition might be confusing, my apologies if so. Hopefully this images (image 1) (image 2) will make it more clear.

Perhaps I misunderstood what you meant by "closing" the door, but if what you meant was turning its collision on, I'm afraid that won't do it. Anyways, thanks again for replying and if you find a way around this please tell me, I would be really thankfull :).

0
By "closing the door" I did in fact mean changing collision properties. Sorry for the confusion! T0XN 276 — 6y