Though my central focus in the workshop is usually educational builds I do at times wander into the realms of fantasy. It is my favourite genre for reading (along with science fiction) and was always the inspiration when I delved into 3D art in my early computing days. In my few leisure hours over the last week I have been putting my hand to a small effect in a fantasy build I’ve had a lot to do with. It uses another type of collision based effect, slightly different in its activation from that which I have previously described, and I thought I’d talk it through here so that others might see the possibility of it. This one does not require stepping onto a solid object to activate the trigger as the Stairway of Learning did, but rather the user (or object) needs to intersect with the trigger to cause the activation. Rather than just having the collision_start event in place this effect first uses the function llVolumeDetect to test that the triggering prim has been intersected, then the collision_start event is activated.
I have used this function previously in the SLENZ Project (midwifery build) to deliver an instructional notecard to users when they passed through a doorway and also in a fantasy setting to open a hidden doorway when the user walks down a tunneled stairway. The effect I developed this week however was a little more out of the ordinary; triggering the sinking of a group of stepping stones that span a waterway to allow a boat to pass through. Yes I know, a little fantasical, but in a world where one can fly the fantastical doesn’t seem so out of place and I must admit I do love the end result.
For the more visually minded these three effects can be seen in the following YouTube video. In each case an initial still image shows the triggering prim highlighted (using Ctrl Alt T and a little Photoshop jiggery pokery). For the best viewing I suggest you go HD and fullscreen.
The function for detecting the intersection, llVolumeDetect, is placed in the state_entry event of the script.
// Any other requirements such as a listener (llListen) or a timer (llSetTimerEvent)
// Generally a variable initiated at the beginning of the script to track that the intersection has occurred is set to FALSE here
Having this function set to TRUE will trigger the collision_start event when any avatar or object intersects with the prim. The avatar or object can intersect the prim because setting llVolumeDetect to TRUE has a similar effect on the scripted prim as setting it to phantom. The required effect is then scripted into the collision_start event.
// If used the variable to mark intersection has occurred is set to TRUE here
// and the effect to be triggered is scripted here
// If a variable is used the effect will be inside an IF statement
In terms of the first effect depicted in the video this worked in a similar manner to the welcome script for the SLENZ Foundation Studies build, adding receivers of the notecard to a list, etc. For the two fantasy effects a timer was created that reversed the effect after a set amount of time. As the collision_start event will trigger if something else intersects the prim during the time the effect is occuring, setting a tracking variable and a timer means the effect will not be set off again until it has completed its cycle and been reset.
The caveats for implementing llVolumeDetect in OpenSim are as follows:
Implementation needs ODE to work, other physics engine only have a stub for this. Persistance of this feature (survive region restart) only implemented for SQLite. Semantics are slightly different to SL (switching off phantom via GUI also resets VolDet-status to off).