Reusable Segmented Door - looking for suggestion

This has been bugging me for a few days. I’ve been throwing together a level editor and am stumbling on this one. What I am trying to accomplish is something similar to a modern overhead garage door-like setup. The door is made up of individual panels but acts as one object following a track. I’ve got the single panel version constructed and scripted how I’d like it to run but I can’t seem to figure out what the best way to go about adding more panels would be. My best solution(only working one so far) was to duplicate everything and then offset the starting and ending nodes for each new panel as I add them(along with moving the new panel to where it belongs). This was quickly turning messy.

I want to keep this as simple and reusable as possible and not hardcode or use animations. Anyone have any suggestion? Demo attached. Sorry if my code sucks. ‘Y’ to activate the door.

Attachments

demo_seg_door.blend (490 KB)

Why not use actions. They are simple and seems to fit pretty much your needs. The only complexity I see is the individual frame offset of each panel.

@ Monster, are you referring to using the action actuator with animations? I want to avoid animating because I want to be able to re-use the script in multiple places with different speeds, number of panels, different number and location of target nodes. The speed will be set as a property of the door_control empty. A new target node can be added by placing an empty and giving it the correct ‘target’ property integer.

I think I just need to ponder on this for a while. And sorry if the panel activation was ‘spacebar’ instead of ‘Y’ I couldn’t remember which one i had it set to when I uploaded the blend.

use a list, and offset what part of the list each piece uses

[[[Vector],[Vector2]],[[Vector],[Vector2]]]

so a list of lists,

where
list[0][0] = the first move vector
list[0][1] = the first angle vector

Inspiration strikes at the strangest times. The first panel will have a ‘head’ property and the last will have a ‘tail’ property. When the door assembly is opening, all of the other panels will only follow the path if the ‘head’ panel is moving. That means when the ‘head’ panel reaches the end target and stops, the rest of the panels will stop also. At this point, we swap ‘head’ and ‘tail’ so when it closes, everything will follow the new ‘head’ which was previously ‘tail’. This only requires one extra target node for the closed position(conveniently placed at the ‘tail’).

A few minor code tweaks and this should be a done deal.

In case anyone was curious, this is what I was going for. It took longer than I thought to wrap my head around it but I managed. If anyone finds this useful, feel free to use it. This one you definitely activate the door with ‘Y’.

Attachments

demo_seg_door_v2.blend (525 KB)