Difference between revisions of "SittingMods"

m
(Setup)
Line 6: Line 6:
  
 
== Setup ==
 
== 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.
+
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. The object must have bounds in order for the clickable to work, and must be an actor, in order for the sittingmod to work.
  
 
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.
 
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.

Revision as of 04:02, 3 June 2008

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. The object must have bounds in order for the clickable to work, and must be an actor, in order for the sittingmod to work.

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