> For the complete documentation index, see [llms.txt](https://raia-software-inc.gitbook.io/tacview-2-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://raia-software-inc.gitbook.io/tacview-2-documentation/api-reference/api-reference/object-data/get-object-pressure-altitude-best-estimate.md).

# GetObjectPressureAltitudeBestEstimate()

Returns the best available estimate of an object's pressure altitude at a specified time.

If no time is specified, the current telemetry playback time is used.

## Syntax

```lua
pressureAltitude = GetObjectPressureAltitudeBestEstimate(objectHandle [, time])
```

## Parameters

### `objectHandle`

Type: `integer`

Handle of the object.

### `time`

Type: `number`

Optional time at which to estimate the value.

If omitted, the current telemetry playback time is used.

## Return value

Type: `number` or `nil`

Returns the best available estimate of the object's pressure altitude, in meters.

Returns `nil` if the object handle is invalid or if Tacview cannot determine a usable altitude value at the specified time.

## Remarks

`GetObjectPressureAltitudeBestEstimate()` is a convenience helper for add-ons that need a practical pressure altitude value without handling every missing-data case themselves.

The function first uses pressure altitude when that value is available in the telemetry. If pressure altitude is not available, it falls back to the object's geometric altitude.

Pressure altitude is the altitude your aircraft would show if the altimeter was set to standard pressure. It should not be confused with geometric altitude.

Use this function for charts, comparisons, exports, Mach number estimation, and aircraft analysis tools where a reasonable pressure altitude value is more useful than a strict pressure-altitude-only result.

If you need to know whether pressure altitude was explicitly available in the telemetry, use `GetObjectPressureAltitude()` instead.

For calculations, keep altitudes in meters. When displaying an altitude in the user interface or writing it to a text file, use the appropriate formatting or conversion function for the target unit and context.

## Example

```lua
local pressureAltitude = GetObjectPressureAltitudeBestEstimate(aircraftHandle, sampleTime)

if pressureAltitude ~= nil then

	-- Use the best available pressure altitude value for the analysis sample.

end
```

## See also

* [GetObjectPressureAltitude()](/tacview-2-documentation/api-reference/api-reference/object-data/get-object-pressure-altitude.md)
* [GetObjectMachNumberBestEstimate()](/tacview-2-documentation/api-reference/api-reference/object-data/get-object-mach-number-best-estimate.md)
* [GetObjectTransform()](/tacview-2-documentation/api-reference/api-reference/object-data/get-object-transform.md)
* [GetTelemetryPlaybackTime()](/tacview-2-documentation/api-reference/api-reference/playback-control/get-telemetry-playback-time.md)
