Samstag, 6. Februar 2010

Avatar Touch Sensors


The Task of Avatar Touch Sensors is to report the avatar user if avatar attachments were touched, for a cat avar for example this means if anybody has touched the fur, for a robot, if anyone touched its body part. Admitelly, the name sounds something like fumbling, but more clean than "Attachment touch sensors"

The first release of ATS was for cat avatars. Dog and than Universal editions follow. Last week, after more than a year of the product story, i decided to merge them all to one edition. The reason to do so is very simple: All three editions are not diferent enough to make me pay listing fee for each of them.

Now what is this tutorial about? To show the ATS in action, we will extend with it my cat pet avatar, found at XStreetSL.

The idea is simple: If a fur attachment is touched, a script in it sends an invisible chat message. The message is received and made visible by a special attachment on HUD or body. Hence, it is necessary to be able to put scripts into fur attachments, thus before the ATS is bought, a check is necessary, if avatar attachments allow to drop scripts into them.

Checking of requirements

First we look into inventory at the avatar folder:

Picture 2: Inventar, Avatar attachments

Here we are lucky in two cases. First, we do not see the (no modify) tag on names, thus we can extend our avatar. Also ther is no (no copy) tag, thus we can and should take copy of the attachments before working on them. It is always important to work on a copy, especially of bought items.

Note: If items are no-copy, it is advisable to ask the builder for a possibility to link own prims with attachments (sections Equiping Part 1 and 2) without to damage them. An experienced builder can surelly ignore the warning ;)

If the inventory shows items as no-modify, it must not mean they are. To be sure, we can rez the attachments inworld and try to put a note in them. As soon that is possible, we are fine.

For our avatar this is possible, thus we take the Cat FTS package and unpack it (attach or rez it, than touch and hit Open button in menu). We have Cat Fur Sensor System now in our inventory.

Package content

Picture 3: Inventar, Cat FTS Package content

The content is:
  • Two landmarks
  • English help note
  • Box texture
  • Sensor scripts
  • Report attachments (HUD and medalion)
  • Invisible prim for linking
We need landmarks later to get updates from vendors. What are the description, texture for, is also clear.

Sensor scripts are all scripts in the package. That are scripts for droping into fur attachments. Report attachments are that objects that make the reports visible, sent by the sensor scripts. The HUD goes to left bottom on screen, the medalion on the body. We will need the medalion if no place on screen is free to attach the HUD. Otherwise the HUD is to prefer.

Invisible prim will help to put sensor scripts into body parts that does not have a separate objects for required scripts, an example will come below.

Equiping, part 1 (body)

If not done already we copy the body attachments to work on it. We have to edit each attachment and put sensor scripts into:

Picture 4: We drop the spine script directly

Each paw uses two parts (lower and upper part), hence we drop for instance the left forepaw script into both lower and upper part (legfront1 and legfront2). The spine script we put into the body attachment, it is a single one, Picture 4. Where goes the stomach script? The body attachment has two child prims with a fur texture in stomach area, we drop the script into each of them. To do that we check the checkbox edit linked parts (in german client it is called verlinkte Teile bearbeiten) so we can select and edit each linked prim.

Similar is for the head. In the head goes the head script, the scripts left ear, right ear go into ear prims (we edit linked parts) and into the chin prim goes the chin script, Picture 5.

Picture 5: chin script goes into the chin prim

A problem we have with the nose script. The head is a sculptie and has no separate prim for the nose. What now to do? For that case we need the invisible prim. It is made transparent, so we can link it to the head attachment without to hurt the picture. To see invisible objects we use Ctrl+Alt+T shortcut. So we rez the prim, make the reasonable size and shape and link the prim to the head at the nose position. The script nose we drop in there.

Picture 6: For the nose script we need an extra prim inplace of nose

Now we are ready with the body. We take all attachment into inventory and attach them. Nothing is changed until we attach the HUD or medalion. From that on we see if anybody touch our fur, first the mesages are private, for us only but we can change that by clicking on the HUD or medalion, as well we can change the language and if we edit the HUD or medalion and drop another prases list we can change the phrases too. We need only one attachment, HUD or medalion and the medalion only in a case, we have no more free slot on HUD for the attachment.

Equiping, part 2 (linking both HUDs)

The Avatar HUD is copy-ok, so we can save the HUD slot and use a single one if we manage to link both HUDs (Avatar HUD and Sensor HUD) together. For that, we rez both inworld, align them properly, select both (the Avatar HUD should be selected as last) and link together. The Avatar HUD should stay the root object. Hint again, if the Avatar HUD would be no-copy, we had to ask the builder if we may link our prims to it. The Sensor HUD is a single prim.

Picture 7: Linking both HUDs together

Now we put the extended HUD on and thest the sensors. Every time we touch the fur, a message about is sent, as well the part that is touched is highlighted on the HUD image and via text over the HUD:

Picture 8: Now is our fur really sensitive

Note: Highlighting of the body parts is implemented in the cat and dog editions as that are special ones. The universal edition is intended for every avatar and can not implement highlighting, for that edition, the touched part is denoted via the title text only.


We see if we edit the HUD (as well the medalion), it contains a script and two phrase notes, Picture 9 left.

Picture 9: Content of the HUD (left) and the menu (right)

The notes contain phrases which are said if a sensor script reports a touch event. If we click the HUD (or medalion) we get a menu where we can set the messages to Mute (nothing reported), Private (only for us) or Public (messages are whispered so everyone nearby knows about), as well we can select the phrases list, given by a note inside the HUD or Medalion. There are two notes suplied, for german and english language, but we can have up to 12 phrase notes and select so the phrase language as well the mod. This ins an example of the EN note:
head          = %a touched my head
left ear      = %a touched my left ear
right ear     = %a touched my right ear
nose          = %a touched my nose
neck          = %a touched my neck
chinn         = %a touched my chinn
chest         = %a touched my chest
stomach       = %a touched my stomach
spine         = %a touched my spine
left forepaw  = %a touched my left forepaw
left backpaw  = %a touched my left backpaw
right forepaw = %a touched my right forepaw
right backpaw = %a touched my right backpaw
tail          = %a touched my tail
The format is simple. After a name of a sensor script reporting touch event, comes an equation sign ant than a phrase to said, where the placeholder is replaced by the name of a person that touched the fur. The universal edition has a longer phrases list (but we only need phrases for used sensor scripts).

That's all. Have fun with it :)

Keine Kommentare:

Kommentar veröffentlichen

Dear creators, internet connection is not a premisse

Hello everyone reading :) This post targets all the people who design and create all the fancy things, be it in hand or on screen. Pleas...