SittingMods

Revision as of 00:20, 18 May 2008 by Nadnerb (Talk | contribs) (New page: NOTE: This feature is not yet available in a release version of PyPRP. It is currently functional in the trunk version from the SVN, however, it's use and interface is subject to change wi...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

NOTE: This feature is not yet available in a release version of PyPRP. It is currently functional in the trunk version from the SVN, however, it's use and interface is subject to change without notice, and may be different at the time of release.

Introduction

Seating Setup
Avatar sitting down

Sitting modifiers allow us to make an avatar stay in a sitting animation for an indefinite period of time, (until the user attempts to move) and thereby give the impression of sitting on an object. Setting up a sitting modifier is very simple.

Setup

First, we need a seat to sit on. A simple cube will do to begin. Create a 2x2 default cube, go into edit mode and shift it up in z 1 unit so that the object center is at the bottom face. Rotate it so that the local y axis is pointing away from the direction you want the avatar to be facing while sitting. Texture it however you like. Name it something meaningful.

Next, create a logic region (Scripts > Add > PyPRP > Add a (generic) Logic Region) and name it something meaningful. This will be our click region. In the next step, we will script the cube to be clickable while inside this region, and the click will trigger the sittingmod.

Adding the script

Add the following alcscript. <object name> refers to the name of the cube we created, and <click region> is the name of the region we created. The action creates a sittingmod with the same name as the object, which is referenced by the modifier actions. You'll also need to make sure that your objects are actors, and have bounds. If you want to have a single separate bench model, and a set of invisible, clickable, sittingmods, simply add the visual.render: false section to the alcscript.

<object name>:
    # the visual segment is optional. Use it if you don't want the clickable to be visible. 
    visual:
        render: false
    logic:
        modifiers:
          - cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: <click region>
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: sittingmod
                ref: sittingmod:<object name>
        actions:
          - type: sittingmod
            sittingmod:
                miscflags: 1