Use run.oppr from the zip. Headless mode needs a graphics renderer.
dotnet tool install -g RecursiveAI.OneScope.ToolRequires .NET 10 (net10.0); .NET 9 and earlier aren’t supported.
onescope open run.oppr --headless \ --size 640x480 --run 'seek {"step":20}' \ --run capture_frame \ --run 'pick {"view":0,"x":233,"y":174}'
The example is the full program below: unzip it and dotnet run.
The zip contains run.oppr and a C# program that runs the same operations, so you can use either the command above or dotnet run.
The last JSON result is the hit:
{"view":0,"source":0,"entity":72057598332895233,"point":[0,3.3707314,0]}The full program
The example installs OneScope.Tool 1.0.0 into its build folder and opens the bundled physics recording, made with OnePhysics, at step 20. It lays out the whole shell with capture_frame, then checks a pixel on the ball and one in empty space. Without a capture or a rendered window frame to lay out the view, pick returns rejected.
using System.Diagnostics; using System.Text.Json; string toolDir = Path.GetFullPath("obj/onescope-tool"); string tool = Path.Combine(toolDir, OperatingSystem.IsWindows() ? "onescope.exe" : "onescope"); if (!File.Exists(tool)) Run("dotnet", "tool", "install", "RecursiveAI.OneScope.Tool", "--version", "1.0.0", "--tool-path", toolDir); var results = Open( """seek {"step":20}""", "capture_frame", """pick {"x":233,"y":174,"view":0}""", """pick {"x":233,"y":205,"view":0}"""); foreach (var pick in results.TakeLast(2)) { var entity = pick.GetProperty("entity"); Console.WriteLine(entity.ValueKind == JsonValueKind.Null ? "Miss" : $"Hit: {entity.GetUInt64()}"); Console.WriteLine($"World point: {pick.GetProperty("point")}"); } JsonElement[] Open(params string[] operations) { var arguments = new List<string> { "open", "run.oppr", "--headless", "--size", "640x480" }; foreach (string operation in operations) arguments.AddRange(["--run", operation]); return Run(tool, arguments.ToArray()) .Split('\n', StringSplitOptions.RemoveEmptyEntries) .Select(line => JsonDocument.Parse(line).RootElement.Clone()) .ToArray(); } static string Run(string command, params string[] arguments) { var start = new ProcessStartInfo(command) { RedirectStandardOutput = true, RedirectStandardError = true }; foreach (string argument in arguments) start.ArgumentList.Add(argument); using var process = Process.Start(start)!; var output = process.StandardOutput.ReadToEndAsync(); var errors = process.StandardError.ReadToEndAsync(); process.WaitForExit(); if (process.ExitCode != 0) throw new InvalidOperationException(output.Result + errors.Result); return output.Result; }
Hit: 72057598332895233 World point: [0,3.3707314,0] Miss World point: [0,-5.097561,0]
Variations
Let OneScope find the view. Use the same command but replace its last line with this one. OneScope finds the scene view under the window pixel; outside all views it returns not_found.
--run 'pick {"x":233,"y":174}'Related recipes
The short answer
Call pick with x and y in window pixels and, optionally, the scene view number. The result names the view and its replay source, reports the entity ID or null, and includes a world-space point. Check entity, not point, to decide whether there was a hit.
How do I find the object under a mouse click?
Pass the click’s coordinates relative to the whole OneScope window, not relative to the scene panel or your desktop. If you’re picking from a screenshot, use a full-shell capture at the same layout and size, not a crop or a view-only export. The sample fixes the shell at 640 × 480 and seeks before laying out the views, so (233, 174) is over the ball in view 0 at step 20. At a different step or after resizing or panning, that same pixel may hit something else.
Picking tests what the replay module draws with the view’s enabled overlays. An entity in the inspector isn’t necessarily drawn. In a 2D view, OneScope maps the pixel onto the world plane at z = 0; in a 3D view, it casts a ray from the camera. A 2D hit point is the mapped pointer position, not the center of the object. Use project for the opposite task: getting an annotation position from an ID you already know.
How do I detect a click in empty space?
Empty space inside a view is a successful pick with "entity":null. In the example, the second point still has a world position because the pixel maps onto the 2D plane. A click outside all scene views is different: if you let OneScope choose the view, it returns not_found because there’s no view to test. Keep those cases separate if a click on empty scene space clears a selection but a click on a toolbar shouldn’t.
The entity ID is an unsigned 64-bit integer. Read it as an integer rather than a floating-point value: the sample’s ID is already too large to round-trip through a JavaScript Number. When sending an ID to another shell operation, the shell accepts the digits as a JSON string.