reckfellENGINE

KinematicCollision2D

The result of tested 2D body motion.

On this page
class KinematicCollision2DReckfellSharpInherits RefCounted

KinematicCollision2D contains contact data: collider, normal, travel and remainder. Check the MoveAndCollide result for null first. After MoveAndSlide, obtain results through GetSlideCollisionCount/GetSlideCollision.

GetTravel and GetRemainder differ: remainder continues motion not yet performed. Do not apply the original displacement again. Validate collider lifetime for deferred handling; a contact does not prevent a game object from being deleted.

Working examples.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

KinematicCollision2DConstructor
# KinematicCollision2D
C#
public KinematicCollision2D();

Methods13

GetAnglefloat
# GetAngle
C#
public float GetAngle(Vector2? upDirection = default);

Returns the collision angle according to up_direction, which is Vector2.Up by default. This value is always positive.

Parameters
NameTypeDefault
upDirectionVector2?default
upDirection

If the parameter is null, then the default value is new Vector2(0.0f, -1.0f).

Returns float
GetColliderReckfellObject
# GetCollider
C#
public ReckfellObject GetCollider();

Returns the colliding body's attached ReckfellObject.

Returns ReckfellObject
GetColliderIdulong
# GetColliderId
C#
public ulong GetColliderId();

Returns the unique instance ID of the colliding body's attached ReckfellObject. See ReckfellObject.GetInstanceId.

Returns ulong
GetColliderRidRid
# GetColliderRid
C#
public Rid GetColliderRid();

Returns the colliding body's Rid used by the PhysicsServer2D.

Returns Rid
GetColliderShapeReckfellObject
# GetColliderShape
C#
public ReckfellObject GetColliderShape();

Returns the colliding body's shape.

Returns ReckfellObject
GetColliderShapeIndexint
# GetColliderShapeIndex
C#
public int GetColliderShapeIndex();

Returns the colliding body's shape index. See CollisionObject2D.

Returns int
GetColliderVelocityVector2
# GetColliderVelocity
C#
public Vector2 GetColliderVelocity();

Returns the colliding body's velocity.

Returns Vector2
GetDepthfloat
# GetDepth
C#
public float GetDepth();

Returns the colliding body's length of overlap along the collision normal.

Returns float
GetLocalShapeReckfellObject
# GetLocalShape
C#
public ReckfellObject GetLocalShape();

Returns the moving object's colliding shape.

Returns ReckfellObject
GetNormalVector2
# GetNormal
C#
public Vector2 GetNormal();

Returns the colliding body's shape's normal at the point of collision.

Returns Vector2
GetPositionVector2
# GetPosition
C#
public Vector2 GetPosition();

Returns the point of collision in global coordinates.

Returns Vector2
GetRemainderVector2
# GetRemainder
C#
public Vector2 GetRemainder();

Unperformed displacement remaining after contact. For reflection, transform both velocity and this remainder; repeating the original segment would add excess travel.

Returns Vector2
GetTravelVector2
# GetTravel
C#
public Vector2 GetTravel();

Returns the moving object's travel before collision.

Returns Vector2
Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.