Skip to content

Commit

Permalink
Basic info about Gizmos util methods
Browse files Browse the repository at this point in the history
  • Loading branch information
marwie committed Nov 13, 2023
1 parent cd21456 commit 85f3d1e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions documentation/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ Here are some of the most commonly used:
- ``gizmos`` enables gizmo rendering (e.g. when using BoxCollider or AxesHelper components)
- and a lot more: please use ``help`` to see them all


## Debug Methods

Needle Engine also has some very powerful and useful debugging methods that are part of the static `Gizmos` class. See the [scripting documentation](./scripting.md#gizmos) for more information.


## Local Testing of release builds
- First, install http-server: `npm install -g http-server`
- make a build (development or production)
Expand Down
18 changes: 18 additions & 0 deletions documentation/scripting.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,24 @@ You can subscribe to those events via `NeedleEngine.registerCallback(ContextEven
| `ContextEvent.ContextCleared` | Called after the context has been cleared |


## Gizmos

The static `Gizmos` class can be used to draw lines, shapes and text which is mostly useful for debugging.
All gizmos function have multiple options for e.g. colors or for how long they should be displayed in the scene. Internally they are cached and re-used.

| Gizmos | |
| -- | -- |
| `Gizmos.DrawLabel` | Draws a label with a background optionally. It can be attached to an object. Returns a Label handle which can be used to update the text. |
| `Gizmos.DrawRay` | Takes an origin and direction in worldspace to draw an infinite ray line |
| `Gizmos.DrawDirection` | Takes a origin and direction to draw a direction in worldspace |
| `Gizmos.DrawLine` | Takes two vec3 worldspace points to draw a line |
| `Gizmos.DrawWireSphere` | Draws a wireframe sphere in worldspace |
| `Gizmos.DrawSphere` | Draws a solid sphere in worldspace |
| `Gizmos.DrawWireBox` | Draws a wireframe box in worldspace |
| `Gizmos.DrawWireBox3` | Draws a wireframe box3 |
| `Gizmos.DrawArrow` | Draws an arrow taking two points in worldspace |


## Serialization / Components in glTF files :tags serialization
To embed components and recreate components with their correct types in glTF, we also need to save non-primitive types (everything that is not a ``Number``, ``Boolean`` or ``String``). You can do so is adding a ``@serializable(<type>)`` decorator above your field or property.

Expand Down

0 comments on commit 85f3d1e

Please sign in to comment.