{"id":21141596,"url":"https://github.com/bjornbytes/lovr-pointer","last_synced_at":"2025-07-09T05:32:06.084Z","repository":{"id":24728722,"uuid":"102228140","full_name":"bjornbytes/lovr-pointer","owner":"bjornbytes","description":"Point at objects in VR","archived":false,"fork":false,"pushed_at":"2022-03-15T19:51:42.000Z","size":4,"stargazers_count":8,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-02T00:44:10.574Z","etag":null,"topics":["lovr"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bjornbytes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-02T22:56:39.000Z","updated_at":"2023-10-09T14:19:43.000Z","dependencies_parsed_at":"2022-07-24T02:32:09.427Z","dependency_job_id":null,"html_url":"https://github.com/bjornbytes/lovr-pointer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjornbytes%2Flovr-pointer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjornbytes%2Flovr-pointer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjornbytes%2Flovr-pointer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjornbytes%2Flovr-pointer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bjornbytes","download_url":"https://codeload.github.com/bjornbytes/lovr-pointer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225486653,"owners_count":17481943,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lovr"],"created_at":"2024-11-20T07:32:13.964Z","updated_at":"2024-11-20T07:32:14.745Z","avatar_url":"https://github.com/bjornbytes.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"lovr-pointer\n===\n\nA [LÖVR](http://lovr.org) library for pointing at objects in VR.\n\nExample\n---\n\n```lua\npointer = require 'pointer'\n\nfunction lovr.load()\n  pointer:init({ source = lovr.headset })\nend\n\nfunction lovr.update()\n  pointer:update()\nend\n\nfunction lovr.draw()\n  local hit = pointer:getHit()\n\n  if hit then\n    lovr.graphics.sphere(hit.x, hit.y, hit.z, .05)\n  end\nend\n```\n\nSee `main.lua` for an example supporting controllers and physics.\n\nUsage\n---\n\nA pointer needs to have a **source** object passed to it when it's initialized.  A source can be any\ntable with `getPosition` and `getOrientation` functions, and it is used to determine the path of the\npointer.  You can point with a controller by passing it in as the source or even use lovr.headset\nfor gaze-based pointing.\n\nBy default, the pointer will cast a line straight out from its source and stop once the line either\nhits the floor or reaches its maximum range (controlled using the `range` option).  You can also\ntell the pointer to check for physics objects along its path by passing a `world` in to initialize.\n\nCalling `getPath` on the pointer returns a list of points along its path.  This list can be passed\ndirectly to `lovr.graphics.line` to draw the pointer's path.\n\nUse `getHit` to get information about what the pointer hit.  This is a table with the following\nfields:\n\n- `x`, `y`, `z` - The position of the hit.\n- `nx`, `ny`, `nz` - The normal vector of the hit.\n- `collider` - The Collider that was hit, if any.\n\nThe hit table isn't always guaranteed to be there and may be `nil` if nothing was hit.\n\nBe sure to call `update` on the pointer whenever you want to recompute the path and hit information.\n\nYou can call all of these functions on the library for convenience, but you can also use `new` to\ncreate a self contained pointer object if you need multiple instances.\n\nAPI\n---\n\n##### `Pointer:init(options)` or `Pointer.new(options)`\n\nInitialize the library or create a new pointer object.  The following optional options are available:\n\n- `source` - A table with `getPosition` and `getOrientation` functions used to do the pointing.\n- `range` - The range of the pointer in meters.\n- `world` - A physics World.  If present, the pointer will check for colliders along its path.\n\n##### `:update()`\n\nUpdate the pointer's path and hit information.  Returns the computed hit information (see `:getHit`).\n\n##### `:getPath()`\n\nReturns a table of positions along the pointer's path.\n\n##### `:getHit()`\n\nReturns information about the closest object hit during the last call to update:\n\n- `x`, `y`, `z` - The position of the intersection point.\n- `nx`, `ny`, `nz` - The normal vector of the intersection point.\n- `collider` - The Collider that was hit, if any.\n\nIf nothing was hit, returns `nil`.\n\n##### `:getSource()` and `:setSource(source)`\n\nGet or set the current source for the pointer.  Sources are tables with `getPosition` and\n`getOrientation` functions used to determine the pointer's path.\n\nLicense\n---\n\nMIT, see [`LICENSE`](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjornbytes%2Flovr-pointer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbjornbytes%2Flovr-pointer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjornbytes%2Flovr-pointer/lists"}