• Stars
    star
    112
  • Rank 310,827 (Top 7 %)
  • Language
    C#
  • Created about 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This asset allows users to view raycasts as the user fires them.

Banner

This asset allows users to view raycasts as the user fires them.

Supports both the 2D and 3D api.

GIF Examples Of All Visuals

3D API (click to expand)

Raycast / Linecast

raycast

RaycastAll / RaycastNonAlloc

raycast_all

CapsuleCast

capsulecast

CapsuleCastAll / CapsuleCastNonAlloc

capsulecast_all

CheckCapsule

check_capsule

OverlapCapsule / OverlapCapsuleNonAlloc

overlap_capsule

BoxCast

boxcast

BoxCastAll / BoxCastNonAlloc

boxcast_all

CheckBox

check_box

OverlapBox / OverlapBoxNonAlloc

overlap_box

SphereCast

spherecast

SphereCastAll / SphereCastNonAlloc

spherecast_all

CheckSphere

check_sphere

OverlapSphere / OverlapSphereNonAlloc

overlap_sphere

Compute Penetration

compute_penetration

Closest Point

closest_point
2D API (click to expand)

Raycast

raycast

RaycastAll / RaycastAll / RaycastNonAlloc

raycast_all

CapsuleCast

capsulecast

CapsuleCastAll / CapsuleCastAll / CapsuleCastNonAlloc

capsulecast_all

OverlapCapsule

overlap_capsule

OverlapCapsuleAll / OverlapCapsuleNonAlloc

overlap_capsule_all

BoxCast

boxcast

BoxCastAll / BoxCastAll / BoxCastNonAlloc

boxcast_all

OverlapBox

overlap_box

OverlapBoxAll / OverlapBoxNonAlloc

overlap_box_all

CircleCast

circlecast

CircleCastAll / CircleCastAll / CircleCastNonAlloc

circlecast_all

OverlapCircle

overlap_circle

OverlapCircleAll / OverlapCircleNonAlloc

overlap_circle_all

OverlapPoint

overlap_point

OverlapPointAll / OverlapPointNonAlloc

overlap_point_all

OverlapArea

overlap_area

OverlapAreaAll / OverlapAreaNonAlloc

overlap_area_all

OverlapCollider

overlap_collider

Closest Point

closest_point

Distance

distance

GetContacts

get_contacts

GetContacts (points)

get_contacts_points

IsTouching

is_touching

IsTouchingLayers

is_touching_layers

GetRayIntersection

get_ray_intersection

GetRayIntersectionAll / GetRayIntersectionNonAlloc

get_ray_intersection_all

Installation

Using Unity Package Manager

  1. Open the Package Manager from Window/Package Manager
  2. Click the '+' button in the top-left of the window
  3. Click 'Add package from git URL'
  4. Provide the URL of this git repository: https://github.com/nomnomab/RaycastVisualization.git
  5. Click the 'add' button

Usage

To get a visual to show up for a physics call simply do the following:

For 3D:

  • Replace Physics. with VisualPhysics..

For 2D:

  • Replace Physics2D. with VisualPhysics2D..
  • Some 2D functions rely more on a 3D perspective in the editor depending on the orientation of the casts.
// Example
void SomeFunction() {
    if (VisualPhysics.Raycast(position, direction)) {
        Debug.Log("Hit!");
    }
}

API Switching:

You can also use a trick to automatically swap between the two APIs (useful for when you want to use the visual API in the editor, but the normal API in builds):

  • Using VisualPhysics in a build will use the normal Physics API, however the method call may not be inlined depending on the compiler's mood.
#if UNITY_EDITOR
using Physics = Nomnom.RaycastVisualization.VisualPhysics;
#else
using Physics = UnityEngine.Physics;
#endif

void SomeFunction() {
    if (Physics.Raycast(position, direction)) {
        Debug.Log("Hit!");
    }
}

Defining a Visual's Lifetime:

Using VisualLifetime.Create(seconds) you can define how long a cast will display for:

// will display the raycast for a second, rather than a single frame
using (VisualLifetime.Create(1f)) {
    if (VisualPhysics.Raycast(position, direction)) {
        Debug.Log("Hit");
    }
}

User Options

The user options are located under Edit/Preferences/RaycastVisualization

Settings

More Repositories

1

Hierarchy-Window-Extensions

This aims to improve the usability of the hierarchy window.
C#
23
star
2

Project-Window-Extensions

This aims to improve the usability of the project window, such as adding copy/paste support.
C#
14
star
3

Quick-Scene

An alternative to the Unity inspector for quicker modifications without leaving the scene.
C#
13
star
4

Folder-Importer-Presets

This package allows for you to have folder-specific asset importers.
C#
12
star
5

New-Package-Helper

This assists in the creation of new local packages through automation of the package layout and package.json
C#
9
star
6

EcsLiteDebugger

Provides a hierarchy and inspector window to view world entities, and mutate components.
C#
7
star
7

inkdrop-water-break

Adds a notification to hydrate yourself!
JavaScript
6
star
8

Regex-Rename

This allows for you to bulk rename both project and scene objects with regex filtering.
C#
6
star
9

IntegratedRust

Allows for handling and compiling cargo projects directly within the Unity Editor.
C#
4
star
10

inkdrop-center-editor

This plugin simply centers the editor for larger screens.
JavaScript
4
star
11

Easier-Custom-Preferences

Makes adding a custom preferences panel easier.
C#
4
star
12

Mod-Lab

Allows for adding in custom scripts during runtime
C#
4
star
13

TagsAndLayers

This asset allows users to use tags and layers without resorting to using strings for value lookups.
C#
3
star
14

create-unity-template

A CLI tool to easily create custom unity project templates.
Rust
3
star
15

Remakes

Remakes of game mechanics / systems for learning purposes.
3
star
16

unity-asset-tabs

This package allows for you to easily make docked tabs for your assets
C#
2
star
17

Chunk-Utilities

Helpful functions and utilities for managing chunk structures.
C#
2
star
18

BitCalculator

This asset allows users to convert formulas into a bit output, and allows for easy bit flipping in-editor.
C#
2
star
19

1-Menu-System

C#
1
star
20

Nomnoms-Utilities

C#
1
star
21

n-entities

A barebones ECS system focused on explicit type constraints.
C#
1
star
22

MajoraBot

JavaScript
1
star