Table of Contents

Class CharacterComponent

Namespace
Stride.Physics
Assembly
Stride.Physics.dll
[DataContract("CharacterComponent")]
[Display("Character", null)]
public sealed class CharacterComponent : PhysicsComponent, IIdentifiable
Inheritance
CharacterComponent
Implements
Inherited Members

Constructors

CharacterComponent()

public CharacterComponent()

Properties

FallSpeed

Gets or sets if this character element fall speed

[DataMember(80)]
public float FallSpeed { get; set; }

Property Value

float

true, false

Gravity

Gets or sets if this character is affected by any gravity

[Display("Gravity", null)]
[DataMember(95)]
public Vector3 Gravity { get; set; }

Property Value

Vector3

A Vector3 representing directional gravity in Stride world units

IsGrounded

Gets a value indicating whether this instance is on the ground.

public bool IsGrounded { get; }

Property Value

bool

true if this instance is grounded; otherwise, false.

JumpSpeed

Gets or sets if this character jump speed

[DataMember(90)]
public float JumpSpeed { get; set; }

Property Value

float

A float representing character jump speed in Stride world units

LinearVelocity

Gets the linear velocity from the kinematic character

public Vector3 LinearVelocity { get; }

Property Value

Vector3

Vector3

MaxSlope

Gets or sets if this character element max slope

[Display("Maximum Slope", null)]
[DataMember(85)]
public AngleSingle MaxSlope { get; set; }

Property Value

AngleSingle

true, false

Orientation

Sets or gets the orientation of the Entity attached to this character controller

public Quaternion Orientation { get; set; }

Property Value

Quaternion

Remarks

This orientation has no impact in the physics simulation

StepHeight

Gets or sets the height of the character step.

[DataMember(75)]
public float StepHeight { get; set; }

Property Value

float

The height of the character step.

Methods

Jump()

Jumps this instance.

public void Jump()

Jump(Vector3)

Jumps this instance.

public void Jump(Vector3 jumpDirection)

Parameters

jumpDirection Vector3

Move(Vector3)

Moves the character towards the specified movement vector. Motion will stay in place unless modified or canceled passing Vector3.Zero.

[Obsolete("Please use SetVelocity instead. SetVelocity internally applies this.GetSimulation().FixedTimeStep")]
public void Move(Vector3 movement)

Parameters

movement Vector3

The velocity vector, typically direction * delta time var dt = this.GetSimulation().FixedTimeStep; * speed.

OnAttach()

protected override void OnAttach()

OnDetach()

protected override void OnDetach()

SetVelocity(Vector3)

Sets the character velocity. Velocity will be applied every frame unless modified or canceled passing Vector3.Zero.

public void SetVelocity(Vector3 velocity)

Parameters

velocity Vector3

The velocity vector, typically direction * speed.

Remarks

The engine internally will multiply velocity with the simulation fixed time step.

Teleport(Vector3)

Teleports the specified target position.

public void Teleport(Vector3 targetPosition)

Parameters

targetPosition Vector3

The target position.