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.
💡 Calls Ray.Cast under the hood. See Ray.Cast definition for more details about possible filters.
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
The direction of the ray cast from screen space PointerEvent.X and PointerEvent.Y into world space.
Indicates whether the PointerEvent represents a touch/click "down" event. If false, it represents a "up" event.
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.