InputEventMouseMotion
Mouse or pen motion data: displacement, velocity and pen fields.
A motion event contains distinct quantities. Position is a point in the recipient's space, Relative is per-event displacement and Velocity is velocity per second. XformedBy preserves ScreenRelative and ScreenVelocity while transforming Relative and Velocity by the basis. Do not multiply an already measured displacement by delta again.
Input accumulation can combine multiple motions: do not treat one callback as one hardware measurement. Disabling Input.UseAccumulatedInput changes accumulation but does not guarantee a fixed device reporting rate or precision.
Pressure, Tilt and PenInverted depend on device data. They can be assigned manually; Pressure and Tilt setters do not clamp their ranges. Testing a synthetic event does not establish tablet support on a particular platform.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
InputEventMouseMotionConstructor
public InputEventMouseMotion();Creates a motion event with zero Relative, ScreenRelative, Velocity, ScreenVelocity, Tilt and Pressure; PenInverted = false. Does not sample the mouse or move the pointer.
Properties7
PenInvertedProperty
public bool PenInverted { get; set; }Flag for the inverted/eraser end when supplied by the device and driver. A manually assigned true is only event data, not proof that a pen or eraser exists.
PressureProperty
public float Pressure { get; set; }Pen pressure, normally normalized by the device to 0..1. The setter stores the number without clamping: a synthetic 1.5 remains 1.5. Validate your own data; zero alone does not identify the device type.
RelativeProperty
public Vector2 Relative { get; set; }Mouse displacement for the event. Event transformation can scale it: scale 2 changed (3, 4) into (6, 8) in the check. This is displacement, not velocity or an absolute point.
ScreenRelativeProperty
public Vector2 ScreenRelative { get; set; }Screen mouse displacement preserved by event transformation. It stayed (3, 4) when Relative became (6, 8) in the check. Useful for look sensitivity without applying viewport scaling again.
ScreenVelocityProperty
public Vector2 ScreenVelocity { get; set; }Screen velocity preserved by event transformation. Distinct from ScreenRelative: velocity and per-event displacement require different time handling.
TiltProperty
public Vector2 Tilt { get; set; }Pen tilt vector; expected device data ranges from -1 to 1 per axis. The setter neither normalizes nor clamps components; synthetic out-of-range values are retained. A zero vector alone does not establish hardware tilt support.
VelocityProperty
public Vector2 Velocity { get; set; }Motion velocity in pixels per second in the event's transformed space. XformedBy applies the transform basis without translation; ScreenVelocity is stored separately. This is not per-event displacement: for direct motion-driven rotation use Relative or ScreenRelative without multiplying by delta again.
Methods14
GetPenInvertedbool
public bool GetPenInverted();Returns the inverted-pen flag stored in PenInverted. Does not poll the device again.
boolCurrent PenInverted value; see the property for units and limits.
GetPressurefloat
public float GetPressure();Returns the pen pressure stored in Pressure. Does not poll the device again.
floatCurrent Pressure value; see the property for units and limits.
GetRelativeVector2
public Vector2 GetRelative();Returns the per-event displacement stored in Relative. Does not poll the device again.
Vector2Current Relative value; see the property for units and limits.
GetScreenRelativeVector2
public Vector2 GetScreenRelative();Returns the screen-space per-event displacement stored in ScreenRelative. Does not poll the device again.
Vector2Current ScreenRelative value; see the property for units and limits.
GetScreenVelocityVector2
public Vector2 GetScreenVelocity();Returns the screen-space velocity in pixels per second stored in ScreenVelocity. Does not poll the device again.
Vector2Current ScreenVelocity value; see the property for units and limits.
GetTiltVector2
public Vector2 GetTilt();Returns the pen tilt vector stored in Tilt. Does not poll the device again.
Vector2Current Tilt value; see the property for units and limits.
GetVelocityVector2
public Vector2 GetVelocity();Returns the velocity in pixels per second stored in Velocity. Does not poll the device again.
Vector2Current Velocity value; see the property for units and limits.
SetPenInvertedvoid
public void SetPenInverted(bool penInverted);Sets PenInverted to the supplied inverted-pen flag using the property rules. Does not generate device movement.
| Name | Type | Default |
|---|---|---|
penInverted | bool | — |
penInvertedNew PenInverted value in the property's units.
SetPressurevoid
public void SetPressure(float pressure);Sets Pressure to the supplied pen pressure using the property rules. Does not generate device movement.
| Name | Type | Default |
|---|---|---|
pressure | float | — |
pressureNew Pressure value in the property's units.
SetRelativevoid
public void SetRelative(Vector2 relative);Sets Relative to the supplied per-event displacement using the property rules. Does not generate device movement.
| Name | Type | Default |
|---|---|---|
relative | Vector2 | — |
relativeNew Relative value in the property's units.
SetScreenRelativevoid
public void SetScreenRelative(Vector2 relative);Sets ScreenRelative to the supplied screen-space per-event displacement using the property rules. Does not generate device movement.
| Name | Type | Default |
|---|---|---|
relative | Vector2 | — |
relativeNew ScreenRelative value in the property's units.
SetScreenVelocityvoid
public void SetScreenVelocity(Vector2 velocity);Sets ScreenVelocity to the supplied screen-space velocity in pixels per second using the property rules. Does not generate device movement.
| Name | Type | Default |
|---|---|---|
velocity | Vector2 | — |
velocityNew ScreenVelocity value in the property's units.
SetTiltvoid
public void SetTilt(Vector2 tilt);Sets Tilt to the supplied pen tilt vector using the property rules. Does not generate device movement.
| Name | Type | Default |
|---|---|---|
tilt | Vector2 | — |
tiltNew Tilt value in the property's units.
SetVelocityvoid
public void SetVelocity(Vector2 velocity);Sets Velocity to the supplied velocity in pixels per second using the property rules. Does not generate device movement.
| Name | Type | Default |
|---|---|---|
velocity | Vector2 | — |
velocityNew Velocity value in the property's units.