PointerEvent

An event that's generated when using the Pointer. (see Pointer.Down or Pointer.Up)

Functions

Casts a ray from PointerEvent screen coordinates and returns an Impact (can be nil).

The Impact contains information about the kind of thing that's been hit.

Pointer.Down = function( pointerEvent )
    local impact = pointerEvent:CastRay()
    if impact.Block ~= nil then
      print("block hit:", impact.Block)
    end

    -- this can also be done using a Ray object:
    local ray = Ray(pointerEvent.Position, pointerEvent.Direction)
    impact = ray:Cast()
    if impact.Block ~= nil then
      print("block hit:", impact.Block)
    end
end

Properties

Horizontal delta, not 0 when moving the pointer (see Pointer.Drag or Pointer.Drag2)

Vertical delta, not 0 when moving the pointer (see Pointer.Drag or Pointer.Drag2)

The direction in which a ray would go based on the PointerEvent.

PointerEvent's location, in world coordinate system.

Horizontal position of the pointer when the event happens, in screen coordinates. {0,0} represents the bottom left of the screen, and {1,1} the top right. X is close to 0.5 when pointing the horizontal center.

Vertical position of the pointer when the event happens, in screen coordinates. {0,0} represents the bottom left of the screen, and {1,1} the top right. Y is close to 0.5 when pointing the vertical center.