Giter Site home page Giter Site logo

xrgizmos's Introduction

XRGizmos

Image

This is an expansion on a technique that Unity demonstrated in their SuperScience library:

https://github.com/Unity-Technologies/SuperScience/tree/main/Runtime/GizmoModule

XRGizmos offers a set of methods to draw primitives similar to Unity's Gizmos class:

  • DrawLine
  • DrawRay
  • DrawSphere
  • DrawWireSphere
  • DrawCube
  • DrawWireCube

It also offers several new methods for other useful shapes:

  • DrawPoint
    • A 3d plus shape to mark a point in 3d space
  • DrawCircle
    • 2d outline of a circle
  • DrawArrow
    • 2d direction indicator
  • DrawPointer
    • A ray with an arrow at the end
  • DrawWireHemisphere
    • Half a sphere
  • DrawAxis
    • Draw the up, right, and forward axes of a transform
  • DrawString
    • Draw a multi-line string in 3D space

Advanced

  • DrawLineList
    • Pass in a list of Vector3s and it will connect them with lines.
  • DrawPointSet
    • Pass in a list of Vector3s and it will mark them all with a point. ~300 points in a single draw call
  • DrawWireCubes
    • Pass in a list of Vector3, a rotation and size and it will draw them all. Useful for grids.

Troubleshooting

To enable XRGizmos you need to add an "XR_GIZMOS" define in your Player Settings. This is so you can easily disable the debug drawing in release builds.

If XRGizmos are drawing in the editor, but they are not showing up in builds the instancing variants of the gizmos shader may be getting stripped from the build.

To workaround this you can add the gizmos shader to the "Always Included Shaders" array in Graphics Settings and change "Instancing Variants" from "Strip Unused" to "Keep All."

Image

The font used to draw text is a modified version of coolbutuseless' "arcadefont": https://github.com/coolbutuseless/arcadefont

If you need more features or better performance than this tool, I recommend the ALINE tool available in the Unity Asset Store.

xrgizmos's People

Contributors

darktable 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.