CharacterComponent Class
Namespace: Stride.PhysicsAssembly: Stride.Physics.dll
[DataContract("CharacterComponent")]
[Display("Character", null)]
public sealed class CharacterComponent : PhysicsComponent, IIdentifiable
Name | Description | |
---|---|---|
Constructors | ||
CharacterComponent() | ||
Properties | ||
FallSpeed | Gets or sets if this character element fall speed |
|
Gravity | Gets or sets if this character is affected by any gravity |
|
IsGrounded | Gets a value indicating whether this instance is on the ground. |
|
JumpSpeed | Gets or sets if this character jump speed |
|
MaxSlope | Gets or sets if this character element max slope |
|
Orientation | Sets or gets the orientation of the Entity attached to this character controller |
|
StepHeight | Gets or sets the height of the character step. |
|
Methods | ||
Jump() | Jumps this instance. |
|
Jump(Vector3) | Jumps this instance. |
|
Move(Vector3) | Moves the character towards the specified movement vector. Motion will stay in place unless modified or canceled passing Vector3.Zero. |
|
OnAttach() | ||
OnDetach() | ||
SetVelocity(Vector3) | Sets the character velocity. Velocity will be applied every frame unless modified or canceled passing Vector3.Zero. |
|
Teleport(Vector3) | Teleports the specified target position. |
Constructors
CharacterComponent()
public CharacterComponent()
Properties
FallSpeed
Gets or sets if this character element fall speed
[DataMember(80)]
public float FallSpeed { get; set; }
Property Value
Type | Description |
---|---|
System.Single | 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
Type | Description |
---|---|
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
Type | Description |
---|---|
System.Boolean |
|
JumpSpeed
Gets or sets if this character jump speed
[DataMember(90)]
public float JumpSpeed { get; set; }
Property Value
Type | Description |
---|---|
System.Single | A float representing character jump speed in Stride world units |
MaxSlope
Gets or sets if this character element max slope
[Display("Maximum Slope", null)]
[DataMember(85)]
public AngleSingle MaxSlope { get; set; }
Property Value
Type | Description |
---|---|
AngleSingle | true, false |
Orientation
Sets or gets the orientation of the Entity attached to this character controller
public Quaternion Orientation { get; set; }
Property Value
Type | Description |
---|---|
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
Type | Description |
---|---|
System.Single | 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
Type | Name | Description |
---|---|---|
Vector3 | jumpDirection |
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
Type | Name | Description |
---|---|---|
Vector3 | movement | The velocity vector, typically direction * delta time |
OnAttach()
protected override void OnAttach()
Overrides
OnDetach()
protected override void OnDetach()
Overrides
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
Type | Name | Description |
---|---|---|
Vector3 | velocity | 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
Type | Name | Description |
---|---|---|
Vector3 | targetPosition | The target position. |