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.
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
Changing the Approach Direction
You can change the direction from which the avatar will attempt to sit on the chair/bench. This is useful if you have a table in front of a chair. To change the approach direction, set the "miscflags" to one of the following:
Approach from front: 1
Approach from left side (from back of chair): 2
Approach from right side (from back of chair): 4
Approach from behind: 8
To approach from more than one side, simply add the flags together. (e.g, If you want to be able to aproach it from the right and left side, you would put 6)
Differences with MOUL
Due to changes between Path of the Shell/Complete Chronicles and Myst Online: URU Live, for best results with a sittingmod, you must keep your clickable object and the actual physical seat object separate. This is because when a sittingmod object is given collision, MOUL has problems.
An example of a sittingmod clickable and seating object configuration (clickable made slightly larger for display purposes):
As with the original method, make sure the sittingmod clickable's local Y axis is pointing away from the direction you'd like the avatar to face when sitting.
<sittingmod clickable> visual: render: false
Use this aforementioned AlcScript in your sittingmod so that the clickable itself is not actually visible and only the seat object is. You may give the seat object any collision you wish although convex hull is easiest on the game engine. NOTE: The clickable will still need UV mapping and a material to export properly.
Note that this method also works in PotS/CC.