ChangeLog

21 August 2015

  • Updated the animator script.

24 July 2012

  • Changes to use timer instead of loops. This is a step forward to making the puppeteer work on OpenSim where even handlers time-out.
  • At tezman Banx's suggestion, added the ability to switch the puppeteer on and off by touching the object (functionality can be removed by deleting the touch_start event in the puppet state).

17 November 2011

  • Added some more to the animator itself so that notecards (card paths) are now hot-swappable.
  • Changed TODO section to FAQ and added some information for attachments and linked primitives.
  • Added to FAQ how to make a looped animation.

15 August 2011

  • Capa Langer mentioned that the puppeteer does not output lines for a few number of steps. This was because in testing only large number of steps were tested. The [K] Puppeteer Recorder script was updated to address this and to output lines even for a few number of steps.

Introduction

A puppeteer is a device in Second Life meant to facilitate the animation of primitives. This is done by recording a set of positions and rotations and then replaying them in order to achieve the animation effect. This puppeteer differs from other puppeteers because it allows both the recording and the animating to be performed within Second Life. An interesting consequence is the recorded data, being saved to a notecard, can be reused for animating a different primitive.

This script can puppeteer objects or individual linked primitives, depending on what movement and rotation is recorded by the recorder script:

  1. if the root primitive of a linked object is recorded, then:
    • The whole object moves using region coordinates.
  2. if a linked primitive in a linked set is recorded, then:
    • Just that primitive moves using local coordinates.

Setup

The puppeteer works in the following way:

  • You drop the recorder script in a primitive you wish to create an animation for.
  • You move or rotate the primitive to the next position and at each step, you touch the primitive and select ◆ Mark ◆.
  • Once you have marked several positions, you touch the puppeteer recorder and select ◆ Dump ◆. This will dump all the recoded data on the local chat and it will look something like this:
Object: ------------- BEGIN CUT -------------
Object: #<57.401940, 113.362300, 1001.491000>#<56.057780, 113.362300, 1001.491000>#<56.057780, 113.362300, 1002.707000>#<56.649890, 113.362300, 1002.707000>#<56.649890, 113.362300, 1003.624000>#<55.782050, 113.362300, 1003.624000>#
Object: [K]
Object: #<.000000, .000000, .000000, 1>#<.000000, .000000, .000000, 1>#<.000000, .000000, .000000, 1>#<.000000, .000000, .000000, 1>#<.000000, .000000, .000000, 1>#<.000000, .000000, .000000, 1>#
Object: -------------- END CUT --------------
  • Now you need to clean it up a little bit to delete the object name (in this case Object: ) from the data as well as the cut lines. After the cleaning, based on the previous example, the data should look like this:
#<57.401940, 113.362300, 1001.491000>#<56.057780, 113.362300, 1001.491000>#<56.057780, 113.362300, 1002.707000>#<56.649890, 113.362300, 1002.707000>#<56.649890, 113.362300, 1003.624000>#<55.782050, 113.362300, 1003.624000>#
[K]
#<.000000, .000000, .000000, 1>#<.000000, .000000, .000000, 1>#<.000000, .000000, .000000, 1>#<.000000, .000000, .000000, 1>#<.000000, .000000, .000000, 1>#<.000000, .000000, .000000, 1>#
  • Now, you take that cleaned data, and save it in a notecard called Puppet.
  • You delete the puppeteer recorder script from the prim and add the notecard Puppet with the data you just cleaned.
  • Finally, you add the animator script in the primitive along with the notecard and the primitive will start executing each step.
  • To stop the puppet from moving, you touch the object.

Frequently Asked Questions

A: Can I use this to animate attachments?

Q: Yes, it works the same way, just create the path while that attachment is attached to yourself to grab the local coordinates.


Q: Can I use this to animate linked primitives, such as wings?

A: Yes, puppeteer each wing. If you puppeteer the root of a linked object, it will move the object itself. If you puppeteer a linked primitive, it will puppeteer just that primitive.


Q: How can I make the puppeteer loop the animation in a seamless path?

A: Suppose that you wanted to make a closed path, such as a circle or a square or a rectangle. You can loop the animation by just marking the last step close to the first one. When the puppeteer reaches the last step, it will jump to the first. However, if that last one is close to the first... It will just loop.


Q: How can I restrict or remove the toggle to turn the puppet on and off?

A: In state puppet, you see this segment:

    touch_start(integer num) {
        if(nDone = ~nDone ) {
            llSetTimerEvent(1.0);
            return;
        }
        llSetTimerEvent(0);
    }

To restrict the puppet to the owner of the object, change the segment to:

    touch_start(integer num) {
        if(llDetectedKey(0) != llGetOwner) return; // <-- allows only the owner to turn the puppet on and off.
        if(nDone = ~nDone ) {
            llSetTimerEvent(1.0);
            return;
        }
        llSetTimerEvent(0);
    }

To eliminate the on/off entirely, useful if the puppeteered primitive should not never be stopped, remove the entire touch_start event handler.


Q: How do I slow it down?

A: There are two ways to slow down puppeteer:

  • you can slow down the number of instructions that puppeteer executes (by changing the above line, and replacing 1 that represents the number of seconds to any other value):

Puppeteer processes each entry in the notecard at the rate of 1 instruction / second. You can see this in the animator code, in two different places:

llSetTimerEvent(1.0);

where 1.0 represents the number of seconds to pause between executing instructions. You can change this to any other value, higher for slower processing of instructions or less for faster execution of commands.

  • you can simply add more points and thereby make the animation slower and smoother as well.

Index


secondlife/puppeteer.txt · Last modified: 2017/02/22 18:30 (external edit)

Access website using Tor


For the copyright, license, warranty and privacy terms for the usage of this website please see the license and privacy pages.