Table of Contents

Class PhysicsComponent

Namespace
Stride.Engine
Assembly
Stride.Physics.dll
[DataContract("PhysicsComponent", Inherited = true)]
[Display("Physics", null, Expand = ExpandRule.Once)]
[DefaultEntityComponentProcessor(typeof(PhysicsProcessor))]
[ComponentOrder(3000)]
[ComponentCategory("Physics")]
public abstract class PhysicsComponent : ActivableEntityComponent, IIdentifiable
Inheritance
PhysicsComponent
Implements
Derived
Inherited Members

Constructors

PhysicsComponent()

protected PhysicsComponent()

Fields

BoneIndex

public int BoneIndex

Field Value

int

BoneWorldMatrix

public Matrix BoneWorldMatrix

Field Value

Matrix

BoneWorldMatrixOut

public Matrix BoneWorldMatrixOut

Field Value

Matrix

colliderShape

protected ColliderShape colliderShape

Field Value

ColliderShape

logger

protected static Logger logger

Field Value

Logger

Properties

CanCollideWith

Gets or sets the can collide with.

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

Property Value

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

bool

CanSleep

Gets or sets if this element can enter sleep state

[DataMember(55)]
[Display("Can sleep", null)]
public bool CanSleep { get; set; }

Property Value

bool

true, false

CcdMotionThreshold

[DataMember(67)]
public float CcdMotionThreshold { get; set; }

Property Value

float

CcdSweptSphereRadius

[DataMember(68)]
public float CcdSweptSphereRadius { get; set; }

Property Value

float

ColliderShape

public virtual ColliderShape ColliderShape { get; set; }

Property Value

ColliderShape

ColliderShapeChanged

public bool ColliderShapeChanged { get; }

Property Value

bool

ColliderShapes

[DataMember(200)]
public PhysicsComponent.ColliderShapeCollection ColliderShapes { get; }

Property Value

PhysicsComponent.ColliderShapeCollection

CollisionGroup

Gets or sets the collision group.

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

Property Value

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

TrackingHashSet<Collision>

Data

protected PhysicsProcessor.AssociatedData Data { get; set; }

Property Value

PhysicsProcessor.AssociatedData

DebugEntity

public Entity DebugEntity { get; set; }

Property Value

Entity

Enabled

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

[DataMember(-10)]
public override bool Enabled { get; set; }

Property Value

bool

true, false

Friction

Gets or sets the friction of this element

[DataMember(65)]
public float Friction { get; set; }

Property Value

float

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

bool

true if this instance is active; otherwise, false.

PhysicsWorldTransform

public Matrix PhysicsWorldTransform { get; set; }

Property Value

Matrix

ProcessCollisions

Gets or sets if this element will store collisions

[Display("Record collision events", null)]
[Obsolete("Always processed and stored by now")]
public bool ProcessCollisions { get; set; }

Property Value

bool

true, false

Restitution

Gets or sets if this element restitution

[DataMember(60)]
public float Restitution { get; set; }

Property Value

float

true, false

RollingFriction

Gets or sets the rolling friction of this element

[DataMember(66)]
public float RollingFriction { get; set; }

Property Value

float

true, false

Simulation

public Simulation Simulation { get; }

Property Value

Simulation

Tag

Gets or sets the tag.

public string Tag { get; set; }

Property Value

string

The tag.

Methods

Activate(bool)

Attempts to awake the collider.

public void Activate(bool forceActivation = false)

Parameters

forceActivation bool

if set to true [force activation].

AddDebugEntity(Scene, RenderGroup, bool)

public void AddDebugEntity(Scene scene, RenderGroup renderGroup = RenderGroup.Group0, bool alwaysAddOffset = false)

Parameters

scene Scene
renderGroup RenderGroup
alwaysAddOffset bool

CollisionEnded()

public ChannelMicroThreadAwaiter<Collision> CollisionEnded()

Returns

ChannelMicroThreadAwaiter<Collision>

ComposeShape()

public void ComposeShape()

IgnoreCollisionWith(PhysicsComponent, CollisionState)

public void IgnoreCollisionWith(PhysicsComponent other, CollisionState state)

Parameters

other PhysicsComponent
state CollisionState

IsIgnoringCollisionWith(PhysicsComponent)

public bool IsIgnoringCollisionWith(PhysicsComponent other)

Parameters

other PhysicsComponent

Returns

bool

NewCollision()

public ChannelMicroThreadAwaiter<Collision> NewCollision()

Returns

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

scene Scene

UpdatePhysicsTransformation(bool)

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(bool forceUpdateTransform = true)

Parameters

forceUpdateTransform bool

Ensure that the Transform.WorldMatrix we are reading from is up to date