Powerlang Docs
  • Welcome!
  • Beginner's Guide
    • Syntax
    • Directives
    • Environment
    • Special types
    • Functions
    • Tables
    • Loops
    • Conditions
    • Events
    • Libraries
    • Comments and Flags
  • Creating a Game
    • Project Introduction: Potato Rush
    • Creating the main game loop
    • Creating potatoes
    • Keeping track of score
  • Libraries
    • Special Types
      • BrickColor
      • CFrame
      • Color3
      • Instance
      • NumberRange
      • UDim2
      • Vector2
      • Vector3
    • Services
      • DataStore
      • Debris
      • Mouse
      • Pathfinding
      • PhysicsService
      • Players
      • Ray
      • TweenService
    • compiler
    • math
    • os
    • string
    • table
    • retrostudio
  • Advanced Information
    • Instance Functions
    • Global Functions
    • Multithreading
    • Compiler Library
Powered by GitBook
On this page
  1. Libraries
  2. Services

Ray

The Ray functionality is used for casting rays through the game environment, enabling developers to perform tasks like detecting intersections with objects. This service is essential for gameplay mechanics such as shooting, line-of-sight calculations, and physics interactions.

Function

Description

findPart(Origin: Vector3, Direction: Vector3, FilterType: string, FilterDescendantsTable: {Instance}): (Instance, Vector3, Vector3)

Casts a ray from a specified origin in a given direction and checks for intersections with parts in the game. Requires 4 arguments: Origin (Vector3), Direction (Vector3), FilterType ("Whitelist" or "Blacklist") to specify the filter type, and FilterDescendantsTable (table of Instances) to filter which parts to check against. Returns the intersected Instance, the intersection Position (Vector3), and the surface Normal (Vector3) at the point of intersection.

PreviousPlayersNextTweenService

Last updated 7 months ago