MeatMotion

Rigidbody2DMotionExtensions

Bind Rigidbody2D position or rotation, including individual position axes.

Namespace
MeatMotion.Extensions
Assembly
MeatMotion

Jump to members

public static class Rigidbody2DMotionExtensions

Requires com.unity.modules.physics2d

Rigidbody2DMotionExtensions.cs · L6

Members

BindToPosition

Use MovePosition by default. Pass false to assign position directly.

public static MotionHandle BindToPosition<TOptions, TAdapter>(this MotionBuilder<Vector2, TOptions, TAdapter> builder, Rigidbody2D rigidbody2d, bool useMovePosition = true)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<Vector2, TOptions>
Parameters and return value
builder
this MotionBuilder<Vector2, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
rigidbody2d
Rigidbody2D Target Rigidbody2D that receives the update.
useMovePosition = true
bool Use MovePosition when true, or assign position directly when false.
Returns
MotionHandle

BindToPositionX

Use MovePosition by default. Pass false to assign position directly. Other components retain their current values; only X changes.

public static MotionHandle BindToPositionX(this FloatMotionBuilder builder, Rigidbody2D rigidbody2d, bool useMovePosition = true)
Parameters and return value
builder
this FloatMotionBuilder Configured builder, passed as the receiver for extension calls.
rigidbody2d
Rigidbody2D Target Rigidbody2D that receives the update.
useMovePosition = true
bool Use MovePosition when true, or assign position directly when false.
Returns
MotionHandle
public static MotionHandle BindToPositionX<TOptions, TAdapter>(this MotionBuilder<float, TOptions, TAdapter> builder, Rigidbody2D rigidbody2d, bool useMovePosition = true)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<float, TOptions>
Parameters and return value
builder
this MotionBuilder<float, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
rigidbody2d
Rigidbody2D Target Rigidbody2D that receives the update.
useMovePosition = true
bool Use MovePosition when true, or assign position directly when false.
Returns
MotionHandle

BindToPositionY

Use MovePosition by default. Pass false to assign position directly. Other components retain their current values; only Y changes.

public static MotionHandle BindToPositionY(this FloatMotionBuilder builder, Rigidbody2D rigidbody2d, bool useMovePosition = true)
Parameters and return value
builder
this FloatMotionBuilder Configured builder, passed as the receiver for extension calls.
rigidbody2d
Rigidbody2D Target Rigidbody2D that receives the update.
useMovePosition = true
bool Use MovePosition when true, or assign position directly when false.
Returns
MotionHandle
public static MotionHandle BindToPositionY<TOptions, TAdapter>(this MotionBuilder<float, TOptions, TAdapter> builder, Rigidbody2D rigidbody2d, bool useMovePosition = true)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<float, TOptions>
Parameters and return value
builder
this MotionBuilder<float, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
rigidbody2d
Rigidbody2D Target Rigidbody2D that receives the update.
useMovePosition = true
bool Use MovePosition when true, or assign position directly when false.
Returns
MotionHandle

BindToRotation

Use MoveRotation by default. Pass false to assign rotation directly.

public static MotionHandle BindToRotation(this FloatMotionBuilder builder, Rigidbody2D rigidbody2d, bool useMovePosition = true)
Parameters and return value
builder
this FloatMotionBuilder Configured builder, passed as the receiver for extension calls.
rigidbody2d
Rigidbody2D Target Rigidbody2D that receives the update.
useMovePosition = true
bool Use MoveRotation when true, or assign rotation directly when false.
Returns
MotionHandle
public static MotionHandle BindToRotation<TOptions, TAdapter>(this MotionBuilder<float, TOptions, TAdapter> builder, Rigidbody2D rigidbody2d, bool useMovePosition = true)
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<float, TOptions>
Parameters and return value
builder
this MotionBuilder<float, TOptions, TAdapter> Configured builder, passed as the receiver for extension calls.
rigidbody2d
Rigidbody2D Target Rigidbody2D that receives the update.
useMovePosition = true
bool Use MoveRotation when true, or assign rotation directly when false.
Returns
MotionHandle