Giter Club home page Giter Club logo

simpleray's Introduction

SimpleRay

Simple module for raycasting on Roblox.

View docs โ†’

Usage

local SimpleRay = require(game.ReplicatedStorage.SimpleRay)

local origin = Vector3.new(0, 0, 0)
local direction = Vector.new(0, 1, 0)
local maxRayInstances = 2

local result = SimpleRay.new({
    Origin = origin,
    Direction = direction,
    Params = {
        IgnoreWater = true,
        Blacklist = {
            workspace.Part2
        }
    },
    MaxParts = maxRayInstances,
    IgnoreCollideOffParts = true,
    IgnoreTransparency = NumberRange.new(0.1, 1),
    CustomFilter = function(inst: Instance)
        return inst.Name ~= "Debug"
    end,
    Visualize = true
}):GetResult()

print(result)
--[[
    Example Output:
    {
        Distance = 50,
        Position = Vector3.new(12, 0, 37),
        Normal = Vector3.new(0, 1, 0),
        Instances = {
            {
                ["Instance"] = workspace.Part,
                ["Material"] = Enum.Material.Plastic,
                ["Normal"] = Vector3.new(0, 0, 1),
                ["Position"] = Vector3.new(-2, 5, -17)
            },
            {
                Instance = workspace.Baseplate,
                Material = Enum.Material.Plastic,
                Normal = Vector3.new(0, 1, 0),
                Position = Vector3.new(12, 0, 37)
            }
        }
    }
]]

simpleray's People

Contributors

synpixel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.