npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rbxts/tracer

v0.0.6-b

Published

Raycast wrapper for Roblox

Downloads

35

Readme

Tracer

Tracer is a Raycast Wrapper that makes Raycasting so much easier, inspired by S&Box Trace API

[!WARNING] Tracer is under Development so anything could change without warnings! (until 1.0.0 releases)

Features

  • Create traces with ease Tracer.ray(startPos, endPos).run() !
  • Most casts in one API! (BlockCast, SphereCast, Raycast)
  • Multiple helper functions to modify or extend your Raycast
    • ignoreObject
    • withTag, withoutTag
    • useRaycastParams
  • Easily creatable using Builder pattern

Setup

npm install @rbxts/tracer
yarn install @rbxts/tracer
pnpm install @rbxts/tracer
bun install @rbxts/tracer

Usage

Basic Raycast

  1. Create a Raycast: Start by creating a ray using the Tracer.ray(startPos, endPos) method. This method requires two parameters: the starting position and the ending position of the ray.
// Direction
const ray = Tracer.ray(startPos, direction, length);

// Positions
const ray = Tracer.ray(startPos, endPos);
  1. Run the Raycast: Once you have created the ray, you can run it using the .run() method. This will execute the raycast and return the results.
const result = ray.run();
if (result.hit) {
    console.log(`Hit at position: ${result.position}`);
}

[!NOTE] The result object will always be returned, even if the ray does not hit anything. You can check if the ray hit something by checking the hit property.

Filters

  • Ignoring Objects: To ignore certain objects during your raycast, use the ignoreObject method.
ray.ignoreObject(someObject);
  • Filtering by Tag: You can include or exclude objects based on their tags using withTag or withoutTag.
ray.withTag("enemy").withoutTag("ally");
  • Custom Raycast Parameters: You can use custom RaycastParams to modify the raycast behavior.
const customParams = new RaycastParams();
customParams.FilterType = Enum.RaycastFilterType.Include;
ray.useRaycastParams(customParams);
  • Custom Filters: For more control over the raycast, use addFilter to add filters that ignore or allow certain hits
ray.addFilter((result) => result.hit === part);

BlockCast and SphereCast

Tracer also supports other types of casts such as BlockCast and SphereCast. Here's how to use them:

// BlockCast
Tracer.box(boxSize, startPos, endPos).run();

// SphereCast
Tracer.sphere(radius, startPos, endPos).run();

Contributing

Contributions are welcome! If you have any ideas, bug reports, or feature requests, please open an issue.