{"id":"pepeeltoro41/jecs-gizmo","name":"jecs-gizmo","scope":"pepeeltoro41","platform":"roblox","description":"Mirrored from the Wally registry.","version":"1.0.2","latest":"1.0.2","versions":["1.0.0","1.0.1","1.0.2"],"license":"MIT","licenseRating":"safe","licenseCaveats":["License identified from the packaged LICENSE file; the manifest declared none."],"licenseVerified":true,"dependencies":{"ukendio/jecs":{"version":"^0.10.0","alias":"jecs"}},"integrity":"47133567a1b5047dc928af38933147c14b583333d6fffacc0931b8608d6c1749","likes":0,"downloads":0,"install":"forest install pepeeltoro41/jecs-gizmo","url":"https://forest.dev/p/roblox/pepeeltoro41/jecs-gizmo","files":"https://api.forest.dev/ai/package/roblox/pepeeltoro41/jecs-gizmo/files","readme":"# Jecs Gizmo\r\n\r\nUtility for debug gizmos for Jecs.\r\n\r\n### Setup\r\n\r\n-   Set all your components that you want to debug. Components that are not provided will not be usable. These are available.\r\n\r\n    -   `transform` for CFrames\r\n    -   `position` for Vector3 positions\r\n    -   `direction` for Vector3 directions\r\n\r\n-   Call `jecs_gizmo.world(world)` **before using it** to set it up with your world.\r\n\r\n-   Add `jecs_gizmo.system()` to your systems. Set the order after all your components are set so your gizmos show the up to date values.\r\n\r\n```luau\r\nlocal c = require(components)\r\nlocal jecs_gizmo = require(jecs_gizmo)\r\n\r\njecs_gizmo.cframe = c.transform\r\njecs_gizmo.position = c.position\r\njecs_gizmo.direction = c.direction\r\n\r\njecs_gizmo.world(world)\r\n\r\nreturn {\r\n    system = function()\r\n        jecs_gizmo.system()\r\n    end\r\n}\r\n```\r\n\r\n### Usage\r\n\r\nUse the components inside `jecs_gizmo.gizmo` to draw gizmos.\r\n\r\n-   `jecs_gizmo.gizmo.cframe` for to draw CFrames. This draws the position and all of the direction vectors.\r\n-   `jecs_gizmo.gizmo.position` for to draw positions, This also works with cframes, Drawing only the position.\r\n-   `jecs_gizmo.gizmo.direction` for to draw directions. This also requires the component to have a position or cframe to draw where the direction starts from.\r\n\r\n-   `jecs_gizmo.gizmo.distance` for to draw distances. This is used as a pair and it calculates the distance between the entity and the target. This requires both entities to have a position or cframe. And they can be mixed up. Like the entity having a cframe and the target having a position.\r\n-   `jecs_gizmo.gizmo.lookvector` for to draw the CFrame's LookVector as an arrow from the CFrame's position.\r\n\r\n```luau\r\nlocal gizmo = require(jecs_gizmo).gizmo\r\n\r\n\r\n-- [[ cframes ]]\r\nlocal cube = world:entity()\r\nworld:set(cube, c.transform, CFrame.new(1, 1, 1))\r\n\r\nworld:add(cube, gizmo.cframe)\r\n-- also works\r\nworld:add(cube, gizmo.position)\r\n\r\n\r\n-- [[ positions ]]\r\nlocal cube = world:entity()\r\n\r\nworld:set(cube, c.position, Vector3.new(1, 1, 1))\r\nworld:add(cube, gizmo.position)\r\n\r\n\r\n-- [[ directions ]]\r\nlocal cube = world:entity()\r\nworld:set(cube, c.transform, CFrame.new(2, 2, 2))\r\nworld:set(cube, c.direction, Vector3.new(0, 1, 0))\r\n-- also works\r\nworld:set(cube, c.position, Vector3.new(0, 1, 0))\r\n\r\nworld:add(cube, gizmo.direction)\r\n\r\n\r\n-- [[ distances ]]\r\nlocal cube1 = world:entity()\r\nlocal cube2 = world:entity()\r\n\r\n-- works with any combination of cframes and positions\r\nworld:set(cube1, c.position, Vector3.new(1, 1, 1))\r\nworld:set(cube2, c.cframe, Vector3.new(10, 10, 10))\r\n\r\nworld:add(cube1, pair(gizmo.distance, cube2))\r\n\r\n\r\n-- [[ lookvectors ]]\r\nlocal cube = world:entity()\r\nworld:set(cube, c.transform,\r\n    CFrame.new(1, 1, 1) * CFrame.Angles(0, math.pi / 2, 0)\r\n)\r\n\r\nworld:add(cube, gizmo.lookvector)\r\n```\r\n\r\n### Configuring the gizmo.\r\n\r\n-   All of the `jecs_gizmo.gizmo` components accept a `Style` as a value. You can set this to change the style of the gizmo. A nil value will use the default style as well as an empty table.\r\n\r\n```luau\r\nlocal gizmo = require(jecs_gizmo).gizmo\r\n\r\nlocal cube = world:entity()\r\nworld:set(cube, c.transform, CFrame.new(1, 1, 1))\r\n\r\nworld:set(cube, gizmo.cframe, {\r\n    scale = true,\r\n})\r\nworld:set(cube, gizmo.lookvector, {\r\n    alwaysOnTop = true,\r\n})\r\n\r\n-- this is the equivalent of setting it to nil or using world:add instead\r\nworld:set(cube, gizmo.position, {})\r\n```\r\n\r\n### Disabling the gizmo.\r\n\r\n-   You can change `jecs_gizmo.enabled` to enable or disable the gizmo. You can modify it at any time.\r\n\r\n```luau\r\nlocal RunService = game:GetService(\"RunService\")\r\nlocal jecs_gizmo = require(jecs_gizmo)\r\n\r\nfunction enable_gizmo()\r\n    jecs_gizmo.enabled = true\r\nend\r\n\r\nfunction disable_gizmo()\r\n    jecs_gizmo.enabled = false\r\nend\r\n\r\njecs_gizmo.enabled = RunService:IsStudio()\r\n```\r\n","readmeTruncated":false}