Click or drag to resize

Physics2DDirectSpaceStateCastMotion Method

Checks how far a Shape2D can move without colliding. All the parameters for the query, including the shape and the motion, are supplied through a Physics2DShapeQueryParameters object.

Returns an array with the safe and unsafe proportions (between 0 and 1) of the motion. The safe proportion is the maximum fraction of the motion that can be made without a collision. The unsafe proportion is the minimum fraction of the distance that must be moved for a collision. If no collision is detected a result of [1.0, 1.0] will be returned.

Note: Any Shape2Ds that the shape is already colliding with e.g. inside of, will be ignored. Use CollideShape(Physics2DShapeQueryParameters, Int32) to determine the Shape2Ds that the shape is already colliding with.

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
public Array CastMotion(
	Physics2DShapeQueryParameters shape
)

Parameters

shape
Type: GodotPhysics2DShapeQueryParameters

[Missing <param name="shape"/> documentation for "M:Godot.Physics2DDirectSpaceState.CastMotion(Godot.Physics2DShapeQueryParameters)"]

Return Value

Type: Array

[Missing <returns> documentation for "M:Godot.Physics2DDirectSpaceState.CastMotion(Godot.Physics2DShapeQueryParameters)"]

See Also