Skip to content

Conversation

@YoloWingPixie
Copy link
Collaborator

@YoloWingPixie YoloWingPixie commented Aug 23, 2025

Expose DCS’ world.searchObjects via WorldService/SearchObjects with full volume support (sphere, box, segment, pyramid).

  • Proto: define SearchObjectsRequest with SearchVolume (sphere/box/ segment/pyramid) using InputPosition for geo points; response returns dcs.common.v0.Target[] to reuse the existing union object type
  • Lua: implement GRPC.methods.searchObjects; build DCS volume tables (world.VolumeType.*) and flattened shapes; return objects wrapped in Target oneof
  • Rust: wire WorldService::search_objects to Lua method

Example request payload:

{
  "categories": [1],
  "volume": {
    "sphere": {
      "center": { "lat": 41.9, "lon": 41.9, "alt": 200 },
      "radius": 3000000
    }
  }
}

Example request payload for a pyramid search:

{
  "categories": [1],
  "volume": {
    "pyramid": {
      "center": { "lat": 43.0, "lon": 44.0, "alt": 0 },
      "forward": { "x": 1, "y": 0, "z": 0 },
      "right":   { "x": 0, "y": 0, "z": 1 },
      "up":      { "x": 0, "y": 1, "z": 0 },
      "length": 3000000,
      "halfAngleHorizontal": 1.56,
      "halfAngleVertical": 1.56
    }
  }
}

Example response:

{
  "objects": [
    {
      "unit": {
        "id": 2,
        "name": "Aerial-2-1",
        "callsign": "Springfield11",
        "coalition": "COALITION_BLUE",
        "type": "A-10A",
        "position": {
          "lat": 43.80128964094778,
          "lon": 36.80316924193918,
          "alt": 1962.2799072265625,
          "u": 206424.18943715096,
          "v": -141278.69705298543
        },
        "orientation": {
          "heading": 95.71059450833623,
          "yaw": 98.36883403042783,
          "pitch": 7.451955739887493,
          "roll": 0.0000330837287922511,
          "forward": {
            "x": -0.098663330078125,
            "y": 0.12969478964805603,
            "z": 0.9866330623626709
          },
          "right": {
            "x": -0.9950371980667114,
            "y": -5.774199962615967e-7,
            "z": -0.09950366616249084
          },
          "up": {
            "x": 0.012904536910355091,
            "y": 0.9915539622306824,
            "z": -0.12905119359493256
          }
        },
        "velocity": {
          "heading": 95.7105901371753,
          "speed": 123.22611009175196,
          "velocity": {
            "x": -12.261449813842773,
            "y": 1.445429801940918,
            "z": 122.61456298828125
          }
        },
        "group": {
          "id": 2,
          "name": "Aerial-2",
          "coalition": "COALITION_BLUE",
          "category": "GROUP_CATEGORY_AIRPLANE"
        },
        "number_in_group": 1
      }
    },
    {
      "unit": {
        "id": 8,
        "name": "Ground-3-1",
        "callsign": "",
        "coalition": "COALITION_BLUE",
        "type": "mrap_mk19",
        "position": {
          "lat": 45.0422479049929,
          "lon": 38.10749053330819,
          "alt": 5.001004695892334,
          "u": 302734.90625,
          "v": 2232.5100098262274
        },
        "orientation": {
          "heading": 0,
          "yaw": 3.6502970123791134,
          "pitch": 0,
          "roll": 0,
          "forward": {
            "x": 1,
            "y": 0,
            "z": 0
          },
          "right": {
            "x": 0,
            "y": 0,
            "z": 1
          },
          "up": {
            "x": 0,
            "y": 1,
            "z": 0
          }
        },
        "velocity": {
          "heading": 0,
          "speed": 0,
          "velocity": {
            "x": 0,
            "y": 0,
            "z": 0
          }
        },
        "group": {
          "id": 8,
          "name": "Ground-3",
          "coalition": "COALITION_BLUE",
          "category": "GROUP_CATEGORY_GROUND"
        },
        "number_in_group": 1
      }
    }
  ]
}

Expose DCS’ world.searchObjects via WorldService/SearchObjects with
full volume support (sphere, box, segment, pyramid).

- Proto: define SearchObjectsRequest with SearchVolume (sphere/box/
  segment/pyramid) using InputPosition for geo points; response returns
  dcs.common.v0.Target[] to reuse the existing union object type
- Lua: implement GRPC.methods.searchObjects; build DCS volume tables
  (world.VolumeType.*) and flattened shapes; return objects wrapped in Target oneof
- Rust: wire WorldService::search_objects to Lua method
- fix: line length for parameter nil guard on sphere
- fix: line length for parameter nil guard on pyramid
- fix: shadowing vec value in normalize function
Copy link
Contributor

@rurounijones rurounijones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me.

@YoloWingPixie YoloWingPixie merged commit 619a719 into DCS-gRPC:main Nov 3, 2025
4 checks passed
@YoloWingPixie YoloWingPixie deleted the yolowingpixie-add-world-searchObjects branch November 3, 2025 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants