This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

CharacterController

The CharacterController sample of the C# Component Samples demo demonstrates the following:

First Person Controller Component#

The FirstPersonController component implements basic first-person player controls. The Player itself consists of a camera and a capsule shape to detect collisions. The component has the following settings available for adjustment:

Creating a Player#

To create a player, you need to create a new Player Dummy (Create -> Camera -> Dummy) and add it to the scene.

Enable the Main Player option for this Player in the Parameters window. Then add the FirstPersonController component to this node.

If you save the world and run the application, you can try to control a player with standard settings.

Settings#

The FirstPersonController component contains several settings groups that are displayed in the Parameters window -> Node tab after assigning the component to a node.

Input Settings#

The Input group allows setting keys to control the character: moving forward and backward, left and right, run and jump modes. You can also adjust the mouse sensitivity that affects the camera rotation speed.

Common Settings#

The Common group contains all physical settings required for the character movements.

To take effect, these physical settings should be applied to a body taking a certain shape in space. The shape can be created in either of the following ways:

  • Generated automatically using the values of the corresponding component parameters.
  • Created manually in UnigineEditor. In this case you need to create Object Dummy (Create -> Physics -> Object Dummy). In the Physics tab of this Object Dummy, assign a Dummy body to it. Then add at least one Capsule shape and adjust its parameters.

To assign your custom manually-created body to the player check the Use External Body option and drag your preconfigured Object Dummy to the Player Body field that becomes available.

Notice
Keep in mind, that the Object Dummy location doesn't affect the player's location at the application start — it is defined by the Player Dummy transformations.

If the Object Dummy is set incorrectly, then a default body is created based on the set of pre-defined parameter values (masks, mass, body size, etc.). If the Object Dummy created in UnigineEditor with a properly configured body is assigned, the parameters Physical Intersection Mask, Collision Mask, Mass, Is Collision, Collision Radius, and Collision Height are hidden. The values will be automatically taken from the first found capsule shape of the Object Dummy.

Physical Intersection Mask The mask for the shape that is used to detect physical intersection with other shapes and rays.
Collison Mask The mask for the shape that is used to detect collisions with other physical objects.
Contacts Intersection Mask The mask that is used to adjust the detected contacts between the capsule shape and other objects. To perform this adjustment, intersection is checked between rays and surfaces of the objects the player shape is currently in contact with.
Mass The mass of the player shape.
Is Collision The flag to toggle the collision check for the player shape.
Collision Radius The capsule shape radius.
Collision Height The capsule shape height. Keep in mind that this value defines only the height of the cylindrical part. The full height of the capsule is calculated as collision height + 2 * collision radius.

Friction The player's static friction, which allows the player to stay steady on a surface, when it doesn't move.
Walk Speed The maximum speed the player can have in the walking mode.
Run Speed The maximum speed the player can have in the running mode.
Acceleration The acceleration applied to achieve the maximum speed.
Damping The coefficient for reducing the player's current speed.
Jump Power The player's jump speed.
Gravity Multiplier An additional multiplier to set the player's current gravity.

Camera Settings#

The Camera group contains settings to adjust the camera.

Camera Height The vertical distance from the bottom point of the capsule, i.e. the height from the player's feet.
Min Theta Angle The minimum vertical camera angle, i.e. maximum possible angle to look down.
Max Theta Angle The maximum vertical camera angle, i.e. maximum possible angle to look up.

Auto Stepping Settings#

The Auto Stepping group of settings fine-tunes automatic climbing upon obstacles of up to a certain height.

Enable Auto Stepping The flag to toggle the Auto Stepping option.
Min Step Height The minimum height of an obstacle for Auto Stepping to be applied. This is required to avoid applying Auto Stepping on even surfaces.
Max Step Height The minimum height of an obstacle that can be climbed upon with Auto Stepping.
Auto Stepping Cancel Angle The maximum slope angle for Auto Stepping to be applied. If a character steps on a slope, the angle of which is greater than the Auto Stepping Cancel Angle value, this last step will be canceled.

Slope Sliding Settings#

The Slope Sliding group contains settings for additional sliding on slopes.

Enable Slope Sliding The flag to toggle the option of sliding on slopes.
Max Static Slope Angle The maximum angle of the slope under the player up to which no additional speed is applied.
Max Slope Angle The angle of the slope under the player at which the maximum sliding speed is applied.
Min Sliding Speed The minimum sliding speed that starts to be applied as soon as the Max Static Slope Angle is overstepped.
Max Sliding Speed The speed of sliding from a slope, which is applied when the surface angle under the player equals to Max Slope Angle.

Objects Interaction Settings#

The Objects Interaction group contains settings that regulate simple physical interaction of the player with other physical objects.

Enable Objects Interaction The flag to toggle interaction with other physical objects. These are the objects that have the Rigid Body assigned.
Force Multiplier The multiplier for the force applied to the Rigid Body the player collides with.

Advanced Settings#

The Advanced Settings group contains settings for the player update, collision detection, and debugging information.

Show Advanced Settings The flag to toggle display of the list of all advanced settings.
Contacts Buffer Size The maximum number of contacts processed during a collision.
Player Actor Fps The minimum framerate update for the player. If the current FPS value is less than this setting, the player is updated several times per frame.
Collision Iterations The number of iterations at processing collisions.
Heavy Contacts Count The maximum number of contacts up to which the Collision Iterations value is applied at processing contacts. If the number of contacts exceeds this value, then only one iteration is used to avoid performance drop.
Show Debug The flag to toggle rendering of debugging information.
Render Basis The flag to toggle rendering of the player's current basis.
Render Velocity The flag to toggle rendering of the player's current speed.
Render Direction The flag to toggle rendering of the camera's current direction.
Render Up Pass Contacts The flag to toggle rendering of contacts on the up pass of Auto Stepping.
Render Side Pass Contacts The flag to toggle rendering of contacts at processing collisions with the player.
Render Down Pass Contacts The flag to toggle rendering of contacts on the down pass of Auto Stepping.
Render Slope Basis The flag to toggle rendering of the basis of the current surface under the player.
Last update: 2020-04-10
Build: ()