Search Results for

    Show / Hide Table of Contents

    Interface IRigidBody2D

    Interface for RigidBody of 2D physics.

    Namespace: Evergine.Common.Physics2D
    Assembly: Evergine.Common.dll
    Syntax
    public interface IRigidBody2D

    Properties

    Active

    Gets or sets a value indicating whether this body start out active?.

    Declaration
    bool Active { get; set; }
    Property Value
    Type Description
    bool

    AllowSleep

    Gets or sets a value indicating whether this flag to false if this body should never fall asleep. Note that this increases CPU usage.

    Declaration
    bool AllowSleep { get; set; }
    Property Value
    Type Description
    bool

    Angle

    Gets the world angle of the body in radians.

    Declaration
    float Angle { get; }
    Property Value
    Type Description
    float

    AngularDamping

    Gets or sets the Angular damping is use to reduce the angular velocity. The damping parameter can be larger than 1.0f but the damping effect becomes sensitive to the time step when the damping parameter is large.

    Declaration
    float AngularDamping { get; set; }
    Property Value
    Type Description
    float

    AngularVelocity

    Gets or sets the angular velocity of the body.

    Declaration
    float AngularVelocity { get; set; }
    Property Value
    Type Description
    float

    Awake

    Gets or sets a value indicating whether this is this body initially awake or sleeping?.

    Declaration
    bool Awake { get; set; }
    Property Value
    Type Description
    bool

    Bullet

    Gets or sets a value indicating whether this is a fast moving body that should be prevented from tunneling through other moving bodies?. Note that all bodies are prevented from tunneling through kinematic and static bodies. This setting is only considered on dynamic bodies.

    Declaration
    bool Bullet { get; set; }
    Property Value
    Type Description
    bool

    ColliderList

    Gets the collider list.

    Declaration
    IEnumerable<ICollider2D> ColliderList { get; }
    Property Value
    Type Description
    IEnumerable<ICollider2D>

    FixedRotation

    Gets or sets a value indicating whether this body be prevented from rotating? Useful for characters.

    Declaration
    bool FixedRotation { get; set; }
    Property Value
    Type Description
    bool

    GravityScale

    Gets or sets the gravity scale applied to this body.

    Declaration
    float GravityScale { get; set; }
    Property Value
    Type Description
    float

    Inertia

    Gets the rotational inertia of the body about the local origin, usually in kg-m^2.

    Declaration
    float Inertia { get; }
    Property Value
    Type Description
    float

    LinearDamping

    Gets or sets the Linear damping is use to reduce the linear velocity. The damping parameter can be larger than 1.0f but the damping effect becomes sensitive to the time step when the damping parameter is large.

    Declaration
    float LinearDamping { get; set; }
    Property Value
    Type Description
    float

    LinearVelocity

    Gets or sets the linear velocity of the body's origin in world co-ordinates.

    Declaration
    Vector2 LinearVelocity { get; set; }
    Property Value
    Type Description
    Vector2

    LocalCenter

    Gets the local position of the center of the mass.

    Declaration
    Vector2 LocalCenter { get; }
    Property Value
    Type Description
    Vector2

    Mass

    Gets the total mass of the body, usually in kg-m^2.

    Declaration
    float Mass { get; }
    Property Value
    Type Description
    float

    MassData

    Gets or sets the mass data of the body.

    Declaration
    RigidBodyMassData2D MassData { get; set; }
    Property Value
    Type Description
    RigidBodyMassData2D

    Position

    Gets the world position of the body.

    Declaration
    Vector2 Position { get; }
    Property Value
    Type Description
    Vector2

    Type

    Gets or sets the rigid body 2D type.

    Declaration
    RigidBodyType2D Type { get; set; }
    Property Value
    Type Description
    RigidBodyType2D

    UserData

    Gets or sets the application specific body data.

    Declaration
    object UserData { get; set; }
    Property Value
    Type Description
    object

    WorldCenter

    Gets the world position of the center of mass.

    Declaration
    Vector2 WorldCenter { get; }
    Property Value
    Type Description
    Vector2

    Methods

    ApplyForce(Vector2, Vector2, bool)

    Apply a force at a world point. If the force is not applied at the center of mass, it will generate a torque and affect the angular velocity. This wakes up the body.

    Declaration
    void ApplyForce(Vector2 force, Vector2 point, bool wake = true)
    Parameters
    Type Name Description
    Vector2 force

    The world force vector, usually in Newtons (N).

    Vector2 point

    The world position of the point of application.

    bool wake

    Also wake up the body.

    ApplyForceToCenter(Vector2, bool)

    Apply a force to the center of mass. This wakes up the body.

    Declaration
    void ApplyForceToCenter(Vector2 force, bool wake = true)
    Parameters
    Type Name Description
    Vector2 force

    The world force vector, usually in Newtons (N).

    bool wake

    Also wake up the body.

    ApplyLinearImpulse(Vector2, Vector2, bool)

    pply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of application is not at the center of mass. This wakes up the body.

    Declaration
    void ApplyLinearImpulse(Vector2 impulse, Vector2 point, bool wake = true)
    Parameters
    Type Name Description
    Vector2 impulse

    The world impulse vector, usually in N-seconds or kg-m/s.

    Vector2 point

    The world position of the point of application.

    bool wake

    Also wake up the body.

    ApplyTorque(float, bool)

    Apply a torque. This affects the angular velocity without affecting the linear velocity of the center of mass. This wakes up the body.

    Declaration
    void ApplyTorque(float torque, bool wake = true)
    Parameters
    Type Name Description
    float torque

    About the z-axis (out of the screen), usually in N-m.

    bool wake

    Also wake up the body.

    CreateCollider(ColliderDef2D)

    Creates a collider with the specified definition.

    Declaration
    ICollider2D CreateCollider(ColliderDef2D def)
    Parameters
    Type Name Description
    ColliderDef2D def

    The collider 2D definition.

    Returns
    Type Description
    ICollider2D

    The collider 2D.

    DestroyCollider(ICollider2D)

    Destroy a fixture. This removes the fixture from the broad-phase and destroys all contacts associated with this fixture. This will automatically adjust the mass of the body if the body is dynamic and the fixture has positive density. All fixtures attached to a body are implicitly destroyed when the body is destroyed.

    Declaration
    void DestroyCollider(ICollider2D collider)
    Parameters
    Type Name Description
    ICollider2D collider

    The collider 2D to be removed.

    GetLinearVelocityFromLocalPoint(Vector2)

    Get the world velocity of a local point.

    Declaration
    Vector2 GetLinearVelocityFromLocalPoint(Vector2 localPoint)
    Parameters
    Type Name Description
    Vector2 localPoint

    Point in local coordinates.

    Returns
    Type Description
    Vector2

    The world velocity of a point.

    GetLinearVelocityFromWorldPoint(Vector2)

    Get the world linear velocity of a world point attached to this body..

    Declaration
    Vector2 GetLinearVelocityFromWorldPoint(Vector2 localPoint)
    Parameters
    Type Name Description
    Vector2 localPoint

    Point in world coordinates.

    Returns
    Type Description
    Vector2

    The world velocity of a point.

    GetLocalPoint(Vector2)

    Gets a local point relative to the body's origin given a world point.

    Declaration
    Vector2 GetLocalPoint(Vector2 worldPoint)
    Parameters
    Type Name Description
    Vector2 worldPoint

    Point in world coordinates.

    Returns
    Type Description
    Vector2

    The corresponding local point relative to the body's origin.

    GetLocalVector(Vector2)

    Gets a local vector given a world vector.

    Declaration
    Vector2 GetLocalVector(Vector2 worldVector)
    Parameters
    Type Name Description
    Vector2 worldVector

    Vector in world coordinates.

    Returns
    Type Description
    Vector2

    The corresponding local vector.

    GetWorldPoint(Vector2)

    Get the world coordinates of a point given the local coordinates.

    Declaration
    Vector2 GetWorldPoint(Vector2 localPoint)
    Parameters
    Type Name Description
    Vector2 localPoint

    A point on the body measured relative the the body's origin.

    Returns
    Type Description
    Vector2

    The same point expressed in world coordinates.

    GetWorldVector(Vector2)

    Get the world coordinates of a vector given the local coordinates.

    Declaration
    Vector2 GetWorldVector(Vector2 localVector)
    Parameters
    Type Name Description
    Vector2 localVector

    A vector fixed in the body.

    Returns
    Type Description
    Vector2

    The same vector expressed in world coordinates.

    ResetMassData()

    This resets the mass properties to the sum of the mass properties of the fixtures.

    Declaration
    void ResetMassData()
    Remarks

    This normally does not need to be called unless you called SetMassData to override the mass and you later want to reset the mass.

    SetTransform(Vector2, float)

    Set the position of the body's origin and rotation. This breaks any contacts and wakes the other bodies. Manipulating a body's transform may cause non-physical behavior.

    Declaration
    void SetTransform(Vector2 worldPosition, float angle)
    Parameters
    Type Name Description
    Vector2 worldPosition

    the world position of the body's local origin.

    float angle

    the world rotation in radians.

    Extension Methods

    ReflectionHelper.GetMemberAssembly(object)
    ReflectionHelper.GetTypeName(object)
    In This Article
    Back to top
    Generated by DocFX