camera_set_projection

Switches projection keeping the framing at the focus point. Orthographic keeps the field of view for the way back; perspective takes fovYDeg, else the kept one, else 45. height (world units, > 0) sets the orthographic visible height.

Command

Usage

TypeScript
surface.execute('camera_set_projection', { kind, fovYDeg?, height?, viewport? })

Parameters

  • kind"perspective" | "orthographic"

    Required

  • fovYDegnumber

    Optional

  • heightnumber

    visible height in world units, > 0

    Optional

  • viewportstring

    the slot (viewport id); the first by default

    Optional

Returns

object with eye, target, up, projection, transition, in the ok: true envelope.

JSON
{
  "type": "object",
  "properties": {
    "eye": {
      "type": "object",
      "description": "f64 world-space point or direction",
      "properties": {
        "x": {
          "type": "number"
        },
        "y": {
          "type": "number"
        },
        "z": {
          "type": "number"
        }
      },
      "required": [
        "x",
        "y",
        "z"
      ]
    },
    "target": {
      "type": "object",
      "description": "f64 world-space point or direction",
      "properties": {
        "x": {
          "type": "number"
        },
        "y": {
          "type": "number"
        },
        "z": {
          "type": "number"
        }
      },
      "required": [
        "x",
        "y",
        "z"
      ]
    },
    "up": {
      "type": "object",
      "description": "f64 world-space point or direction",
      "properties": {
        "x": {
          "type": "number"
        },
        "y": {
          "type": "number"
        },
        "z": {
          "type": "number"
        }
      },
      "required": [
        "x",
        "y",
        "z"
      ]
    },
    "projection": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "perspective",
            "orthographic"
          ]
        },
        "fovYDeg": {
          "type": "number"
        },
        "height": {
          "type": "number"
        }
      },
      "required": [
        "kind"
      ]
    },
    "transition": {
      "type": "integer",
      "minimum": 1
    }
  },
  "required": [
    "eye",
    "target",
    "up",
    "projection"
  ]
}

See also