genEric - The Drag and Drop Character

Documentation and User Guide

Version 1.0 - August 2013

Introduction

genEric is a complete character ready to drop into your Unity scene. He includes basic animations for walking, running, jumping, falling, turning and crouching. The project also includes an intelligent camera that adjusts to smaller spaces and a sample rooftop environment to run around it.

Table Of Contents

Introduction

Section 1: Quick Start with the genEric model

Section 2: Camera Settings

Section 3: genEric Model Settings

Section 4: Keyboard And Joystick Controls

Section 5: Creating a Death Volume

Section 6: Setting up Extra Joystick Controls

Section 7: Transferring genEric to Your Own Character

Section 8: Support Information


Section 1: Quick Start with the genEric model

For a super quick start simply load the sample scene. This has the genEric model all set up and ready to run around. Use the “h” key to expand the on-screen help to see the character controls. You can also plug in a joystick to control the character.

Setting Up genEric In Your Own Scene

1) Add the genEric model into your scene.

The model should be ready to go. Use the arrow keys or the joystick to move around. Hit the "h" key on the keyboard for help.

2) Add the genCamera which will follow genEric around.

If you have an existing camera in the scene you should delete it first. Otherwise it will conflict with the genEric camera.

  - Drag the camera from genEric/prefabs/genCamera into the scene.

  - Select the "genCamera" in the Hierarchy window.

  - look in the inspector panel and ensure that the "Follow Camera" component is opened up. You should see a "Target" parameter in the component.

  - Drag the "genEric" model from the Hierarchy window onto the  "Target" parameter.

The camera will automatically follow genEric around in the scene.


Section 2: Camera Settings

The genEric Camera has a number of controls to adjust the camera in the scene. You can edit these by selecting the genCamera in your scene and looking in the inspector tab under the genEric Camera Script component.

Target

drag the model you want to follow onto this parameter

Distance

adjust the distance of the camera to the target

Height

adjust the height of the camera

Look at Offset

adjust the tilt of the camera

Damping

adjust how fast the camera follows the target. Lower numbers are slower and higher numbers faster.

Manual Offset

rotate the camera around the target. You can also use "[" and "]" on the keyboard for this

Character Height

Adjust this value if you find that the camera is getting stuck in ceilings

Section 3: genEric Model Settings

To access the settings for the genEric model, select the model in your scene window or hierarchy and look in the inspector tab under the genEric Control Script.

Direction Damp Time

lower values make him turn faster and higher values make him turn more slowly.

Death From Falling Distance

Falling from a height of this distance will kill the character.

Hard Landing Distance

Falling from this height will trigger a hard landing animation.

Falling Threshold

This value is falling velocity. If he is falling at least this fast he will transition to a falling animation.

Extra Joystick Controls

There are a few extra controls that can be added to the joystick controls. These need to be set up in the Input Manager before you can use this feature. See this section for help on setting this up.

Fatal Object Tag

If genEric collides with an object that has this tag it will trigger a death animation. This is set to “respawn” by default. See this section for help on setting this up.

Show Help

This toggles whether the on-screen keyboard help is displayed or not.

   


Section 4: Keyboard And Joystick Controls

There are a number of custom keyboard controls for genEric. The common ones like jump, run and turn can be configured through the Input Manager. The others can be configured in the genEricControl script.

Action

Keyboard

Joystick

walk forward

w

Left stick up

run forward

Shift + w

Left stick up farther

walk backwards

s

Left stick down

turn left

a

Left stick left

turn right

d

Left stick right

turn 180

shift + s

Left stick push in

jump

space

Button 0 (Fire 1)

sidestep left

Shift + a

D-pad left *

sidestep right

Shift + d

D-pad right *

turn left while walking

w + a

Left stick forward left

turn right while walking

w + d

Left stick forward right

turn left while running

Shift + w + a

Left stick forward left

turn right while running

Shift + w + d

Left stick forward right

crouch

c

Button 1 (Fire 2)

move forward/back while crouching

c + w

Fire 2 + left stick

toggles running mode. This makes “w” run instead of walking

r

N/A

rotate the camera to the left

[

rotate the camera to the right

]

 


Section 5: Creating a Death Volume

If you want genEric to die from a collision with a specific object (E.g. bullet, lava, etc), simply create a tag for the death object called “fatal”. This will trigger the death animation on genEric. This is done by setting the “fatalDamage” flag in the mechanim Animator.

If you want to apply damage to the character you can add a hook in the the OnCollisionEnter() method in the main genEricCtrl.cs script.

Section 6: Setting up Extra Joystick Controls

There are a couple of controls available on the keyboard that require some extra setup if you want to use them with the joystick controls. Unity’s InputManager doesn’t currently allow this to be done through code. The extra controls are sideStep and turn180.

Here’s how to add the additional settings to your Input Manager:

  1. edit → project settings → input
  2. expand the axes group
  3. click beside “size” and change the value to two higher than it’s current setting (E.g. change 15 to 17).
  4. expand the second last group on the bottom.
  5. change the name to “Turn180”
  6. change the positive button to “joystick button 8”
  7. expand the second last group on the bottom.
  8. change the name to “sideStep”
  9. change the type to to “Joystick Axis”
  10. change the Axis to “6th Axis (Joysticks)


Section 7: Transferring genEric to Your Own Character

  1. Setup your character to use mechanim
  1. select the character in your project
  2. select the Rig tab
  3. set the animation type to humanoid
  4. leave the setting at “Create from this model” and hit apply
  5. note: you may need to click the “configure” button and assign bones depending on how well the bones in your model are named. See the mechanim docs for details.

  1. Add the genEric Animator component
  1. drag the character into your scene
  2. select the character in the Hierarchy tab and look at the animator component in the inspector. It will look something like this:

 

  1. under the genEric/models folder you should find an Animator object. The icon looks like this:

 

  1. Drag it onto the Controller slot in the Animator component.

  1. Cheat step! You can copy the CapsuleCollider and the Rigidbody from the genEric model if you like. You will still need to adjust them as shown in the following steps.
  1. drag the genEric prefab into your scene from the genEric/prefabs folder
  2. select the genEric GameObject in the Hierarchy tab
  3. right click on the CapsuleCollider in the Inspector tab. Pick “Copy Component”
  4. select your model in the Hierarchy tab
  5. right click in the Inspector tab. Pick “Paste Component as New”
  6. copy and paste the Rigidbody component the same way

  1. Add a capsule collider to the character
  1. select the root of the character in the Hierarchy tab
  2. Component → physics → CapsuleCollider (if you didn’t add it in step 3)
  3. In the Inspector tab, configure the capsule collider to match your character by adjusting the center, radius, height and direction. This is what it should look like and the sample settings that work for genEric. Your model may be a bit different.

  1. Add a Rigidbody component to the character
  1. select the character in the Hierarchy tab
  2. Component → physics → Rigidbody (if you didn’t add it in step 3)
  3. adjust the settings as shown. The constraints in particular are very important or the character will fall over!

  1. Add the genEric controller
  1. select the character in the Hierarchy tab
  2. find the genEricCtrl script under genEric\scripts
  3. drag it onto your character

Section 8: Support Information

For additional FAQ’s (coming soon), tutorial videos (coming soon) or to submit bugs, comments or feature requests please visit our support page at http://www.bokboklabs.com/support.html.