Difference between revisions of "SittingMods"
(Added dimensions image.) |
|||
Line 41: | Line 41: | ||
sittingmod: | sittingmod: | ||
miscflags: 1 | 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 |
Revision as of 14:04, 11 August 2008
Introduction
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
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