Stride

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

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

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

    PhysicsComponent Class

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

    [DataContract("PhysicsComponent", Inherited = true)]
    [Display("Physics", null, Expand = ExpandRule.Once)]
    [DefaultEntityComponentProcessor(typeof(PhysicsProcessor))]
    [ComponentOrder(3000)]
    [ComponentCategory("Physics")]
    public abstract class PhysicsComponent : ActivableEntityComponent, IIdentifiable
    Name Description
    Constructors
    PhysicsComponent()
    Fields
    BoneIndex
    BoneWorldMatrix
    BoneWorldMatrixOut
    colliderShape
    logger
    Properties
    CanCollideWith

    Gets or sets the can collide with.

    CanScaleShape
    CanSleep

    Gets or sets if this element can enter sleep state

    CcdMotionThreshold
    CcdSweptSphereRadius
    ColliderShape
    ColliderShapeChanged
    ColliderShapes
    CollisionGroup

    Gets or sets the collision group.

    Collisions
    Data
    DebugEntity
    Enabled

    Gets or sets if this element is enabled in the physics engine

    Friction

    Gets or sets the friction of this element

    IsActive

    Gets a value indicating whether this instance is active (awake).

    PhysicsWorldTransform
    ProcessCollisions

    Gets or sets if this element will store collisions

    Restitution

    Gets or sets if this element restitution

    RollingFriction

    Gets or sets the rolling friction of this element

    Simulation
    Tag

    Gets or sets the tag.

    Methods
    Activate(Boolean)

    Attempts to awake the collider.

    AddDebugEntity(Scene, RenderGroup, Boolean)
    CollisionEnded()
    ComposeShape()
    IgnoreCollisionWith(PhysicsComponent, CollisionState)
    IsIgnoringCollisionWith(PhysicsComponent)
    NewCollision()
    OnAttach()
    OnDetach()
    OnUpdateBones()
    OnUpdateDraw()
    RemoveDebugEntity(Scene)
    UpdatePhysicsTransformation()

    Forces an update from the TransformComponent to the Collider.PhysicsWorldTransform. Useful to manually force movements. In the case of dynamic rigidbodies a velocity reset should be applied first.

    | Improve this Doc View Source

    Constructors


    PhysicsComponent()

    protected PhysicsComponent()
    | Improve this Doc View Source

    Fields


    BoneIndex

    public int BoneIndex
    Field Value
    Type Description
    System.Int32

    BoneWorldMatrix

    public Matrix BoneWorldMatrix
    Field Value
    Type Description
    Matrix

    BoneWorldMatrixOut

    public Matrix BoneWorldMatrixOut
    Field Value
    Type Description
    Matrix

    colliderShape

    protected ColliderShape colliderShape
    Field Value
    Type Description
    ColliderShape

    logger

    protected static Logger logger
    Field Value
    Type Description
    Logger
    | Improve this Doc View Source

    Properties


    CanCollideWith

    Gets or sets the can collide with.

    [DataMember(40)]
    [Display("Collides with...", null)]
    public CollisionFilterGroupFlags CanCollideWith { get; set; }
    Property Value
    Type Description
    CollisionFilterGroupFlags

    The can collide with.

    Remarks

    The collider will still produce events, to allow non trigger rigidbodies or static colliders to act as a trigger if required for certain filtering groups.


    CanScaleShape

    public bool CanScaleShape { get; set; }
    Property Value
    Type Description
    System.Boolean

    CanSleep

    Gets or sets if this element can enter sleep state

    [DataMember(55)]
    [Display("Can sleep", null)]
    public bool CanSleep { get; set; }
    Property Value
    Type Description
    System.Boolean

    true, false


    CcdMotionThreshold

    [DataMember(67)]
    public float CcdMotionThreshold { get; set; }
    Property Value
    Type Description
    System.Single

    CcdSweptSphereRadius

    [DataMember(68)]
    public float CcdSweptSphereRadius { get; set; }
    Property Value
    Type Description
    System.Single

    ColliderShape

    public virtual ColliderShape ColliderShape { get; set; }
    Property Value
    Type Description
    ColliderShape

    ColliderShapeChanged

    public bool ColliderShapeChanged { get; }
    Property Value
    Type Description
    System.Boolean

    ColliderShapes

    [DataMember(200)]
    public PhysicsComponent.ColliderShapeCollection ColliderShapes { get; }
    Property Value
    Type Description
    PhysicsComponent.ColliderShapeCollection

    CollisionGroup

    Gets or sets the collision group.

    [DataMember(30)]
    [Display("Collision group", null)]
    public CollisionFilterGroups CollisionGroup { get; set; }
    Property Value
    Type Description
    CollisionFilterGroups

    The collision group.

    Remarks

    The collider will still produce events, to allow non trigger rigidbodies or static colliders to act as a trigger if required for certain filtering groups.


    Collisions

    public TrackingHashSet<Collision> Collisions { get; }
    Property Value
    Type Description
    TrackingHashSet<Collision>

    Data

    protected PhysicsProcessor.AssociatedData Data { get; set; }
    Property Value
    Type Description
    PhysicsProcessor.AssociatedData

    DebugEntity

    public Entity DebugEntity { get; set; }
    Property Value
    Type Description
    Entity

    Enabled

    Gets or sets if this element is enabled in the physics engine

    [DataMember(-10)]
    public override bool Enabled { get; set; }
    Property Value
    Type Description
    System.Boolean

    true, false

    Overrides
    ActivableEntityComponent.Enabled

    Friction

    Gets or sets the friction of this element

    [DataMember(65)]
    public float Friction { get; set; }
    Property Value
    Type Description
    System.Single

    true, false

    Remarks

    It's important to realise that friction and restitution are not values of any particular surface, but rather a value of the interaction of two surfaces. So why is it defined for each object? In order to determine the overall friction and restitution between any two surfaces in a collision.


    IsActive

    Gets a value indicating whether this instance is active (awake).

    public bool IsActive { get; }
    Property Value
    Type Description
    System.Boolean

    true if this instance is active; otherwise, false.


    PhysicsWorldTransform

    public Matrix PhysicsWorldTransform { get; set; }
    Property Value
    Type Description
    Matrix

    ProcessCollisions

    Gets or sets if this element will store collisions

    [Display("Record collision events", null)]
    public bool ProcessCollisions { get; set; }
    Property Value
    Type Description
    System.Boolean

    true, false


    Restitution

    Gets or sets if this element restitution

    [DataMember(60)]
    public float Restitution { get; set; }
    Property Value
    Type Description
    System.Single

    true, false


    RollingFriction

    Gets or sets the rolling friction of this element

    [DataMember(66)]
    public float RollingFriction { get; set; }
    Property Value
    Type Description
    System.Single

    true, false


    Simulation

    public Simulation Simulation { get; }
    Property Value
    Type Description
    Simulation

    Tag

    Gets or sets the tag.

    public string Tag { get; set; }
    Property Value
    Type Description
    System.String

    The tag.

    | Improve this Doc View Source

    Methods


    Activate(Boolean)

    Attempts to awake the collider.

    public void Activate(bool forceActivation = false)
    Parameters
    Type Name Description
    System.Boolean forceActivation

    if set to true [force activation].


    AddDebugEntity(Scene, RenderGroup, Boolean)

    public void AddDebugEntity(Scene scene, RenderGroup renderGroup = RenderGroup.Group0, bool alwaysAddOffset = false)
    Parameters
    Type Name Description
    Scene scene
    RenderGroup renderGroup
    System.Boolean alwaysAddOffset

    CollisionEnded()

    public ChannelMicroThreadAwaiter<Collision> CollisionEnded()
    Returns
    Type Description
    ChannelMicroThreadAwaiter<Collision>

    ComposeShape()

    public void ComposeShape()

    IgnoreCollisionWith(PhysicsComponent, CollisionState)

    public void IgnoreCollisionWith(PhysicsComponent other, CollisionState state)
    Parameters
    Type Name Description
    PhysicsComponent other
    CollisionState state

    IsIgnoringCollisionWith(PhysicsComponent)

    public bool IsIgnoringCollisionWith(PhysicsComponent other)
    Parameters
    Type Name Description
    PhysicsComponent other
    Returns
    Type Description
    System.Boolean

    NewCollision()

    public ChannelMicroThreadAwaiter<Collision> NewCollision()
    Returns
    Type Description
    ChannelMicroThreadAwaiter<Collision>

    OnAttach()

    protected virtual void OnAttach()

    OnDetach()

    protected virtual void OnDetach()

    OnUpdateBones()

    protected virtual void OnUpdateBones()

    OnUpdateDraw()

    protected virtual void OnUpdateDraw()

    RemoveDebugEntity(Scene)

    public void RemoveDebugEntity(Scene scene)
    Parameters
    Type Name Description
    Scene scene

    UpdatePhysicsTransformation()

    Forces an update from the TransformComponent to the Collider.PhysicsWorldTransform. Useful to manually force movements. In the case of dynamic rigidbodies a velocity reset should be applied first.

    public void UpdatePhysicsTransformation()

    Inherited Members

    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