GraLL 2, Generic Door Prefab
Here’s the first GraLL 2 ‘prefab’: The generic Door. A prefab is basically a Blender object that puts together a ‘native’ object and a Python script to create something ‘new’. In this case, a generic Door is made out of a SlidingBrush.
The generic Door has properties like ‘repeat’ (whether the Door can be opened multiple times) and ‘autoClose’ (whether the Door closes automatically after being opened). However, the most interesting property is ‘condition’. This is a Python script that runs in the scope of the ‘collide’ function, which evaluates to a True/False value that is checked when the Door is opened. Thus, the Door is not bound to a fixed condition like whether the Player has a Key, or whether a Switch is on. The condition can be any arbitrary Python script, which can again reference any arbitrary data. So, you can have a condition like, ‘other.getLinearVelocity().squaredLength() > 100’ to only open if he’s moving faster than 10 units per second. In fact, you can even have conditions like, ‘is this particular music track playing’. ;-)
Check out the thumbnail for an in-Blender view of the Door. The Door script (which is pretty short actually) is in the window on the top right. The properties for the Door can be seen in the bottom left window. Pretty cool, eh? :-)
On a side note, I forgot to mention something new I added quite a while back: Glow. Yep, more shader eye-candy! Check out the pictures on Flickr.