Table of Contents

Struct Collision

Namespace
Stride.Physics
Assembly
Stride.Physics.dll

A pair of component colliding with each other. Pair of [b,a] is considered equal to [a,b].

public readonly struct Collision : IEquatable<Collision>
Implements
Inherited Members

Constructors

Collision(PhysicsComponent, PhysicsComponent)

public Collision(PhysicsComponent a, PhysicsComponent b)

Parameters

a PhysicsComponent
b PhysicsComponent

Fields

ColliderA

public readonly PhysicsComponent ColliderA

Field Value

PhysicsComponent

ColliderB

public readonly PhysicsComponent ColliderB

Field Value

PhysicsComponent

Properties

AreColliding

public bool AreColliding { get; }

Property Value

bool

Contacts

public HashSet<ContactPoint> Contacts { get; }

Property Value

HashSet<ContactPoint>

HasEndedFromComponentRemoval

True if the collision has ended because one of the colliders has been removed, either by removing the entity from the scene or by removing physics component from the entity.

public bool HasEndedFromComponentRemoval { get; }

Property Value

bool

Remarks

If true, it is not safe to invoke further actions on the colliders. Only use colliders information to identify the entity that has been removed.

Methods

ContactChanged()

The returned collection contains the previous contacts, new contacts are under Contacts

public ChannelMicroThreadAwaiter<HashSet<ContactPoint>> ContactChanged()

Returns

ChannelMicroThreadAwaiter<HashSet<ContactPoint>>

Ended()

public Task Ended()

Returns

Task

Equals(Collision)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Collision other)

Parameters

other Collision

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

Operators

operator ==(in Collision, in Collision)

public static bool operator ==(in Collision a, in Collision b)

Parameters

a Collision
b Collision

Returns

bool

operator !=(in Collision, in Collision)

public static bool operator !=(in Collision a, in Collision b)

Parameters

a Collision
b Collision

Returns

bool