Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    CharacterComponent Class

    Namespace: Stride.Physics
    Assembly: Stride.Physics.dll
    System.Object → EntityComponent → ActivableEntityComponent → PhysicsComponent → CharacterComponent
    Derived from CharacterComponent:

    [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.

    | Improve this Doc View Source

    Constructors


    CharacterComponent()

    public CharacterComponent()
    | Improve this Doc View Source

    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

    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
    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.

    | Improve this Doc View Source

    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 var dt = this.GetSimulation().FixedTimeStep; * speed.


    OnAttach()

    protected override void OnAttach()
    Overrides
    PhysicsComponent.OnAttach()

    OnDetach()

    protected override void OnDetach()
    Overrides
    PhysicsComponent.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
    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.


    Inherited Members

    PhysicsComponent.logger
    PhysicsComponent.ColliderShapes
    PhysicsComponent.CollisionGroup
    PhysicsComponent.CanCollideWith
    PhysicsComponent.ProcessCollisions
    PhysicsComponent.Enabled
    PhysicsComponent.CanSleep
    PhysicsComponent.IsActive
    PhysicsComponent.Activate(Boolean)
    PhysicsComponent.Restitution
    PhysicsComponent.Friction
    PhysicsComponent.RollingFriction
    PhysicsComponent.CcdMotionThreshold
    PhysicsComponent.CcdSweptSphereRadius
    PhysicsComponent.Collisions
    PhysicsComponent.NewCollision()
    PhysicsComponent.CollisionEnded()
    PhysicsComponent.Simulation
    PhysicsComponent.ColliderShapeChanged
    PhysicsComponent.colliderShape
    PhysicsComponent.ColliderShape
    PhysicsComponent.CanScaleShape
    PhysicsComponent.PhysicsWorldTransform
    PhysicsComponent.Tag
    PhysicsComponent.BoneWorldMatrix
    PhysicsComponent.BoneWorldMatrixOut
    PhysicsComponent.BoneIndex
    PhysicsComponent.Data
    PhysicsComponent.DebugEntity
    PhysicsComponent.AddDebugEntity(Scene, RenderGroup, Boolean)
    PhysicsComponent.RemoveDebugEntity(Scene)
    PhysicsComponent.UpdatePhysicsTransformation()
    PhysicsComponent.ComposeShape()
    PhysicsComponent.OnUpdateDraw()
    PhysicsComponent.OnUpdateBones()
    PhysicsComponent.IgnoreCollisionWith(PhysicsComponent, CollisionState)
    PhysicsComponent.IsIgnoringCollisionWith(PhysicsComponent)
    EntityComponent.Entity
    EntityComponent.Id
    EntityComponent.EnsureEntity

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation