Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Creating a door to fit a gap in two walls

Author
Message
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 13th Dec 2021 21:57
Here is some code to fit a door to two walls. It works like this;
1) When it creates a wall it attaches a plane to the left and right edge of the wall (You could make these invisible in a production environment)
2) It creates a door and sets it's pivot point to the left so it can swing open/closed
3) When it fits the door to the gap between the walls it takes the left marker of the first wall and the right marker of the second wall and uses those objects to calculate the gap. The the width of the door is gap/door_width. It also positions the door to the world position of the right edge marker of the first wall.
This way the orientation of the walls doesn't matter.

jd_zoo
5
Years of Service
User Offline
Joined: 12th May 2018
Location: Nova Scotia
Posted: 13th Dec 2021 22:14
That is a fun mechanic! I can't think of how to use it...but I made a really big door

Login to post a reply

Server time is: 2024-04-18 22:57:43
Your offset time is: 2024-04-18 22:57:43