.comment-link {margin-left:.6em;}
Moriash Moreau: My Second Life
Wednesday, June 15, 2005
 
Useless Script
As I mentioned previously, I spent a bit of time over the weekend coming up with a script to let avatars jump on the bed at my new summer cottage. It's simple, "Hello World!" level coding, and I'm sure someone has done somewhat similar things before. Who cares? Mine makes sproingy-sproingy noises!

In any case, if anyone is interested, here's a copy of the script.

Addendum 6/15/05, 9:06am:
So, late last night, Chres and I installed this script on her bed in her chateau in snowy Afton. This script is silly and completely pointless, but dang if it's not fun! In a fit of technical fervor, I ended up adding a dialog box menu to set the jump height. (I'm going to add a timer to it today to reset the height back to the lowest setting after a few minutes.) The chateau has nice, high vaulted ceilings in the bedroom, so we were able to set the vertical height a fair bit higher. So, now you can touch the bed, and it asks you "How high do you want to jump?" The options are Mild, Kinky, Crazy, and Skullcracker. (The first three are Chres's idea. The last is mine.)


I suppose I should add a couple of cautionary remarks for this script. First, if the top surface on your bed is curved (this is common, to better simulate a real quilt), it won't work properly. Specifically, your avatar will hit the surface and bounce slightly off to one side (in the direction of the curve) before the upward impulse is applied. This is normal physics behavior (envision dropping a ball on a sloped or curved surface), but it means that you will be thrown off the bed after a few bounces. The easiest fix would be to add an invisible (100% alpha) rectangle that sits just slightly above the curved blanket. This will present a nice, flat, horizontal landing surface. You can also unlink the blanket and make it phantom, then install the script in the (hopefully flat) mattress itself. This works fine, but it means your bed is now two unlinked parts. It's also a little harder to find an appropriate surface to right click on to enter the bed, since most of the surface is covered with an unrelated blanket.

Second, be sure and make the root prim of your bed at rotation <0,0,0>. This is just like installing sit positions in furniture. If your root prim is rotated at some odd angle, you'll have to do some extra figuring to get the initial positions right when entering the bed. It can be done, but it's so much easier just to plan ahead and adjust your root prim properly.

Third, the bed will go "Sproing!" when you bump into the sides. As far as the script is concerned, a collision is a collision. This includes headboard and footboard, if your bed has one. This isn't really a big deal, I don't think, but if it bothers you, make the mattress a separate entity.
Comments: Post a Comment



Return to Main Page