---
title: "GetVehicleRotationQuat | open.mp"
description: "Returns a vehicle's rotation on all axes as a quaternion."
canonical: https://omp.itsneufox.com/zh-TW/docs/scripting/functions/GetVehicleRotationQuat
language: zh-TW
---

# GetVehicleRotationQuat

## Description

Returns a vehicle's rotation on all axes as a quaternion.

| Name | Description |
| --- | --- |
| vehicleid | The ID of the vehicle to get the rotation of. |
| &Float:w | A float variable in which to store the first quaternion angle, passed by reference. |
| &Float:x | A float variable in which to store the second quaternion angle, passed by reference. |
| &Float:y | A float variable in which to store the third quaternion angle, passed by reference. |
| &Float:z | A float variable in which to store the fourth quaternion angle, passed by reference. |

## Returns

**true** - The function was executed successfully.

**false** - The function failed to execute. This means the vehicle specified does not exist.

The vehicle's rotation is stored in the specified variables.

## Examples

```c
new
    Float:w,
    Float:x,
    Float:y,
    Float:z;

GetVehicleRotationQuat(vehicleid, w, x, y, z);
```

## Notes

備註

There is no 'set' variation of this function; you can not SET a vehicle's rotation (apart from the Z angle)

注意

This function may return incorrect values for unoccupied vehicles. The reason is that the third row of the vehicle's internal rotation matrix gets corrupted if it gets updated while unoccupied.

## Related Functions

-   [GetVehicleZAngle](https://omp.itsneufox.com/zh-TW/docs/scripting/functions/GetVehicleZAngle): Check the current angle of a vehicle.
-   [GetVehicleRotation](https://omp.itsneufox.com/zh-TW/docs/scripting/functions/GetVehicleRotation): Get the rotation of a vehicle on the XYZ axis.
-   [GetVehicleMatrix](https://omp.itsneufox.com/zh-TW/docs/scripting/functions/GetVehicleMatrix): Gets the actual rotation matrix of the vehicle.
