Click or drag to resize
DigitalRuneKinematicCharacterController Class
Controls the movement of a game character.
Inheritance Hierarchy
SystemObject
  DigitalRune.Physics.SpecializedKinematicCharacterController

Namespace: DigitalRune.Physics.Specialized
Assembly: DigitalRune.Physics.Specialized (in DigitalRune.Physics.Specialized.dll) Version: 1.10.0.0 (1.10.0.0)
Syntax
public class KinematicCharacterController

The KinematicCharacterController type exposes the following members.

Constructors
  NameDescription
Public methodKinematicCharacterController(Simulation)
Initializes a new instance of the KinematicCharacterController class.
Public methodKinematicCharacterController(Simulation, Vector3F)
Initializes a new instance of the KinematicCharacterController class.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodMove
Moves the character to a new position while avoiding penetrations and sliding along obstacles.
Public methodResolvePenetrations
Tries to move the character to the nearest position where it does not penetrate other objects.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Properties
  NameDescription
Public propertyBody
Gets or sets the body.
Public propertyCollisionGroup
Gets or sets the collision group.
Public propertyEnabled
Gets or sets a value indicating whether this character controller is enabled.
Public propertyGravity
Gets or sets the gravity.
Public propertyHasGroundContact
Gets a value indicating whether this character has ground contact.
Public propertyHeight
Gets or sets the height.
Public propertyIsClimbing
Gets or sets a value indicating whether this instance is climbing.
Public propertyJumpManeuverability
Gets or sets the jump maneuverability.
Public propertyMaxVelocity
Gets or sets the maximum velocity of the character.
Public propertyNumberOfSlideIterations
Gets or sets the number of slide iterations.
Public propertyNumberOfSolverIterations
Gets or sets the number of solver iterations.
Public propertyPosition
Gets or sets the position of the character.
Public propertyPushForce
Gets or sets the maximal push force with which the character pushes other objects.
Public propertySimulation
Gets or sets the simulation.
Public propertySlopeLimit
Gets or sets the slope limit (in radians).
Public propertyStepHeight
Gets or sets the height of the step.
Public propertyUpVector
Gets the vector that points into the "up" direction.
Public propertyVelocity
Gets the current velocity of the character controller.
Public propertyWidth
Gets or sets the width.
Top
Remarks

The character is represented by an upright capsule. When the character moves, it will slide along obstacles to create a smooth movement. The character can move on light slopes, but will be stopped by steep slopes (see SlopeLimit). The character will automatically step over obstacles and climb onto steps up to a certain height limit (see StepHeight).

A single RigidBody (see property Body) is created for the character capsule and added to a Simulation, which is specified when the character controller is created. The RigidBody can be used to set the collision group and collision filtering. The RigidBody is automatically added to the Simulation when the character controller is created and removed from the Simulation when the character controller is disabled.

To teleport the character to a new position, simply set the property Position directly.

The character controller applies gravity itself and the Body should be excluded from global force effects like gravity and damping.

To move the character Move(Vector3F, Single, Single) must be called. This will immediately compute a new position. But the Simulation can also move the character, for example, when it is pushed by kinematic objects. Therefore, the position is only final after the simulation was updated.

General notes: In first person shooters character speeds up to 10 m/s are used. This is about twice as fast as normal human movement. For this high speed, the gravity is often set to a higher than normal value, like 16 m/s², to account for this unnatural speed.

See Also