Skip to content

Character: Setup

Jakub Lukasik edited this page Sep 2, 2021 · 5 revisions

This page describes how to setup outerra's default character implementation using charob and anim_module interfaces to produce fully animated asset of character.

Prerequisites:

  • character_plugin.dll
  • charctrl_plugin.dll

your_model.objdef

In objdef set physics and script to character.

"physics" : "character",
"script" : "@character"

Physic set as "character" tells engine, that object is type of charob. Script set as "@character" says, that name of class, that implements charob interface (in character_plugin.dll) is "character". '@' at beginning means, that implementation is native (c++).

character.cfg

This file needs to be next to the package. It specifies locomotion movement values, path to animation graph and some values used when character is entered in vehicle.

Detailed information
{
    "steering" :
    {
        "enable_cam_rotation" : true,  // is enabled for player to rotate camera when in vehicle
        "center_speed"        : 1.0  // if rotation enabled, how fast will camera center
    },

    "animation" :
    {
        "graph_file"          : "anim_graph/char.graph",  // path to anim. graph, relative or absolute
        "use_root_motion"     : true  // should be root motion of animations used
    },

    "move_acc"                : 10.0,  // movement acceleration

    "walk_speed"              : 1.5,  // max speed for walking forward
    "walk_back_speed"         : 1.2,  // max speed for walking backward
    "walk_strafe_speed"       : 1.4,  // max speed for walking sideways

    "run_speed"               : 4.4,  // max speed for running forward
    "run_back_speed"          : 2.9,  // max speed for running backward
    "run_strafe_speed"        : 4.3,  // max speed for running sideways

    "rot_acc"                 : 10.0,  // rotation acceleration
    "rot_speed"               : 8.0  // max speed of rotation
}

skeleton.cfg

This file needs to be next to the package. It specifies type of skeleton, meshes used in model, bone name mapping and attachment slots.

Detailed information
{
    "type" : "biped",  // only "biped" supported for now

    "meshes" :
    {
        "head" : "char_head",  // head mesh (hidden when first-person)
        "body" : "char_body"  // not used in code for now
    },

    "skeleton" :  // bone mapping, processed at initialization for direct bone indexing
    {
        "pelvis"     : "char:Hips",
        "spine"      : "char:Spine",
        "spine1"     : "char:Spine1",
        "spine2"     : "char:Spine2",
        "neck"       : "char:Neck",
        "head"       : "char:Head",
        "r_clavicle" : "char:RightShoulder",
        "r_shoulder" : "char:RightArm",
        "r_elbow"    : "char:RightForeArm",
        "r_wrist"    : "char:RightHand",
        "l_clavicle" : "char:LeftShoulder",
        "l_shoulder" : "char:LeftArm",
        "l_elbow"    : "char:LeftForeArm",
        "l_wrist"    : "char:LeftHand",
        "r_thigh"    : "char:RightUpLeg",
        "r_knee"     : "char:RightLeg",
        "r_foot"     : "char:RightFoot",
        "r_toes"     : "char:RightToeBase",
        "l_thigh"    : "char:LeftUpLeg",
        "l_knee"     : "char:LeftLeg",
        "l_foot"     : "char:LeftFoot",
        "l_toes"     : "char:LeftToeBase"
    },

    "attachment_slots" :  // optional attachment slots for items. If not defined, shoulder bones are used
    {
        "r_shoulder" : "att:RightShoulder",
        "l_shoulder" : "att:LeftShoulder"
    }
}

your_animation_graph.graph

This file defines whole animation state graph. It is created by Animation editor. For correct character functionality and animation, following animation inputs should be defined:

  • speed_y [float] // forward/backward speed
  • speed_x [float] // sideway speed
  • elevation [float] // current elevation
  • jump [bool] // trigger for jump sequence
  • aiming [bool] // flag determining if character is in aiming mode
  • aim_z [float] // vertical aiming angle (in radians)
  • turn_delta [float] // delta angle of horizontal rotation (in radians)
  • pose [int] // index of pose to use { "none", "sit" }
  • steering [bool] // flag determining if character is steering vehicle
  • pick_up_item [bool] // trigger for item picking sequence
  • drop_item [bool] // trigger for item dropping sequence
  • holster_item [bool] // trigger for item holstering sequence
  • draw_item [bool] // trigger for item drawing sequence