VR-Lab PS-ERT Primer - Character
written by pilardi 11/01
last updated by pilardi 12/01
Back to overview
Properties of characters:
-
name - a string that can be used to get a handle on the character.
-
type - the basic appearance of the character. For example,
male_pedestrian.
-
appearance - a modifier to type. Each character-type has its
own set of possible appearances. E.g. chris1, darren3.
-
action - what the character is doing. Each character-type
has its own set of possible actions. E.g. stand, walk,
run,
dead.
-
path - the path that the character follows while doing its action.
Pre-set paths can only be created using PeopleShop (on NT). If no
path is specified, the character goes straight in the direction of his
heading. So, paths can be created on the fly by changing the heading
of the character.
-
links - joints that can be adjusted to move the characters limbs.
Each character-type has its own set of links. E.g. shoulder_l,
elbow_r
Unfortunately this feature is not available in version 1.5. BDI claims
it will be available sometime in 2002. Right now you can only query the
links, not change them.
How to set and change these properties
-
Name and type are specified in the scenario file (.pss).
-
Preset appearances, actions, and paths for each character can also be specified
in the scenario file (.pss).
-
Appearances, actions, paths (through heading), and links as well as many
other features can be controlled on-the-fly using the psScenarioCharacter
class described below.
Other notes
-
See the each character-type's
page
for a list of actions, appearances, and links associated with that character.
Appearances are listed under shape sets.
-
Character types and appearances can be previewed in using
run_character_viewer.sh
in
$BDI_PEOPLESHOP.
-
Expressive faces (exface) is an add-on to Peopleshop. Only certain appearances
have this property. Also, It is not very well integrated into the
geometry and textures. There are some texture problems around the
neck area. Hopefully this will be fixed in a future version.
psScenarioCharacter class
Link to official doc.
A psScenarioCharacter pointer allows you to control a character associated
with that pointer. To get a pointer for a particular character, use the
psScenario::get_character_at_index(...)
or the
psScenario::find_character() methods from the psScenario
pointer.
CharWrapper in psert_util
is a wrapper to the psScenarioCharacter class. I suggest
using the CharWrapper class instead of psScenarioCharacter class,
since it is a superset.
Important Methods
All methods return 0 on success and -1 on failure, unless otherwise
specified.
Basic methods
-
char* get_name()
Returns the scenario name of the character.
-
char* get_character_type_string()
Returns the character-type.
-
set_current_appearance(char*)
Changes the appearance. Each character-type has it's own set
of appearances. See character-type's
page
for a list of appearances.
Gaze methods
Nod describes the orientation of the head, while gaze combines head
and eye orientation. Nod and gaze are equivalent for characters without
expressive faces (because they do not have movable eyes).
-
set_nod(azi,elev)
float get_nod_azimuth()
float get_nod_elevation()
These methods set and retrieve the azimuth (heading) and elevation
(pitch) values of the character. These values are in the characters local
coordinate system.
-
set_gaze(azi,elev)
float get_gaze_azimuth()
float get_gaze_elevation()
Same as nod above, but controls both head and eye position.
-
gaze_at_point(x,y,z)
get_gaze_point(&x,&y,&z)
x, y, and z are in global coordinates.
-
end_gaze()
Resets gaze origin.
Position and action methods
-
set_aim(azi,elev)
float get_aim_azimuth()
float get_aim_elevation()
These sets and retrieves the aim of the character's weapon if the character
is carrying one.
-
get_position(&x,&y,&z,&rz,&rx,&ry)
set_position(x,y,z,rz,rx,ry)
Sets and retrieves the absolute position and orientation (in degrees)
of the character. rz is heading. In PS-ERT, rz=90 is
equivalent to heading=0 in Performer. rx and ry seem
to be ignored.
-
char* get_current_action_by_name()
set_desired_action_by_name("name",stay_on_path=0)
The character makes a natural transition from its current action to
the specified actions. Each character-type has it's own set of actions.
See character type's
page for a
list of appearances. An optional stay_on_path parameter
is available if you want the character is on a preset path and you would
like the character to stay on that path.
-
force_action_by_name("name",include_transition_arc,max_rampdown_interval,stay_on_path=0)
This method is the same as the previous one, but give more control
over the transition. Use include_transition_arc of 1 for
smooth transition and 0 for immediate transition. max_rampdown_interval
controls the length of the transition. The official doc recommends
0.0->0.5. The higher the number, the smoother the transition.
Expressive face methods
These methods are only available on characters with
"exface" appearances.
-
set_emotion("name",weight)
float get_emotion("name")
Sets and retrieves character's emotion. weight should be between
-1 and 1. set_emotion("all",0) resets emotions. See below
for list of emotions.
-
set_viseme("name",weight)
float get_viseme("name")
Sets and retrieves character's mouth position. weight should
be between -1 and 1. set_viseme("all",0) resets visemes. See below
for list of visemes. Timed sequences of visemes can be done through
the speak command.
-
set_automatic_eye_blinks_switch(int)
int get_automatic_eye_blinks_switch()
When this is turned on, character blinks randomly.
-
speak(char*)
int is_speaking()
speak()allows you to do timed sequences of visemes. speak("\\load[file=
[file.phn] ]") will move the character's mouth based on the contents
of the .phn file. See *** to learn how to make .phn
files.
The SGI version of PS-ERT doesn't support sound, so uses the 3dsound utility
located in the repository under vrlab/src/libraries/util/3dsound.[ch] for
sound.
is_speaking() always returns 0; I'm not sure if that is
a bug or a feature. It may be related not being able to play sound on the
SGI.
Available emotions
-
all
-
Smile_cl
-
Trust
-
Sad
-
Mad
-
Distrust
-
Conniving
-
Smile
-
BrowsDown
-
BrowsUp
Available visemes
-
aa
-
b
-
ch
-
d
-
eh
-
el
-
en
-
ey
-
f
-
g
-
ih
-
iy
-
ow
-
r
-
s
-
th
-
uh
-
uw