user: How do I use XrSessionState(bpy_struct) in Blender? Include parameters, examples, warnings and best practices.

assistant: # XrSessionState(bpy_struct)

base class — [`bpy_struct`](bpy.types.bpy_struct.html#bpy.types.bpy_struct "bpy.types.bpy_struct")

*class* bpy.types.XrSessionState(*bpy_struct*)
:   Runtime state information about the VR session

    actionmaps
    :   Type:
        :   [`XrActionMaps`](bpy.types.XrActionMaps.html#bpy.types.XrActionMaps "bpy.types.XrActionMaps") [`bpy_prop_collection`](bpy.types.bpy_prop_collection.html#bpy.types.bpy_prop_collection "bpy.types.bpy_prop_collection") of [`XrActionMap`](bpy.types.XrActionMap.html#bpy.types.XrActionMap "bpy.types.XrActionMap"), (readonly)

    active_actionmap
    :   Type:
        :   int in [-inf, inf], default 0

    navigation_location
    :   Location offset to apply to base pose when determining viewer location

        Type:
        :   [`mathutils.Vector`](mathutils.html#mathutils.Vector "mathutils.Vector") of 3 items in [-inf, inf], default (0.0, 0.0, 0.0)

    navigation_rotation
    :   Rotation offset to apply to base pose when determining viewer rotation

        Type:
        :   [`mathutils.Quaternion`](mathutils.html#mathutils.Quaternion "mathutils.Quaternion") rotation of 4 items in [-inf, inf], default (0.0, 0.0, 0.0, 0.0)

    navigation_scale
    :   Additional scale multiplier to apply to base scale when determining viewer scale

        Type:
        :   float in [-inf, inf], default 0.0

    selected_actionmap
    :   Type:
        :   int in [-inf, inf], default 0

    viewer_pose_location
    :   Last known location of the viewer pose (center between the eyes) in world space

        Type:
        :   [`mathutils.Vector`](mathutils.html#mathutils.Vector "mathutils.Vector") of 3 items in [-inf, inf], default (0.0, 0.0, 0.0), (readonly)

    viewer_pose_rotation
    :   Last known rotation of the viewer pose (center between the eyes) in world space

        Type:
        :   [`mathutils.Quaternion`](mathutils.html#mathutils.Quaternion "mathutils.Quaternion") rotation of 4 items in [-inf, inf], default (0.0, 0.0, 0.0, 0.0), (readonly)

    *classmethod* is_running(*context*)
    :   Query if the VR session is currently running

        Returns:
        :   Result

        Return type:
        :   boolean

    *classmethod* reset_to_base_pose(*context*)
    :   Force resetting of position and rotation deltas

    *classmethod* action_set_create(*context*, *actionmap*)
    :   Create a VR action set

        Returns:
        :   Result

        Return type:
        :   boolean

    *classmethod* action_create(*context*, *actionmap*, *actionmap_item*)
    :   Create a VR action

        Returns:
        :   Result

        Return type:
        :   boolean

    *classmethod* action_binding_create(*context*, *actionmap*, *actionmap_item*, *actionmap_binding*)
    :   Create a VR action binding

        Returns:
        :   Result

        Return type:
        :   boolean

    *classmethod* active_action_set_set(*context*, *action_set*)
    :   Set the active VR action set

        Parameters:
        :   **action_set** (*string**,* *(**never None**)*) – Action Set, Action set name

        Returns:
        :   Result

        Return type:
        :   boolean

    *classmethod* controller_pose_actions_set(*context*, *action_set*, *grip_action*, *aim_action*)
    :   Set the actions that determine the VR controller poses

        Parameters:
        :   - **action_set** (*string**,* *(**never None**)*) – Action Set, Action set name
            - **grip_action** (*string**,* *(**never None**)*) – Grip Action, Name of the action representing the controller grips
            - **aim_action** (*string**,* *(**never None**)*) – Aim Action, Name of the action representing the controller aims

        Returns:
        :   Result

        Return type:
        :   boolean

    *classmethod* action_state_get(*context*, *action_set_name*, *action_name*, *user_path*)
    :   Get the current state of a VR action

        Parameters:
        :   - **action_set_name** (*string**,* *(**never None**)*) – Action Set, Action set name
            - **action_name** (*string**,* *(**never None**)*) – Action, Action name
            - **user_path** (*string**,* *(**never None**)*) – User Path, OpenXR user path

        Returns:
        :   Action State, Current state of the VR action. Second float value is only set for 2D vector type actions.

        Return type:
        :   float array of 2 items in [-inf, inf], (never None)

    *classmethod* haptic_action_apply(*context*, *action_set_name*, *action_name*, *user_path*, *duration*, *frequency*, *amplitude*)
    :   Apply a VR haptic action

        Parameters:
        :   - **action_set_name** (*string**,* *(**never None**)*) – Action Set, Action set name
            - **action_name** (*string**,* *(**never None**)*) – Action, Action name
            - **user_path** (*string**,* *(**never None**)*) – User Path, Optional OpenXR user path. If not set, the action will be applied to all paths.
            - **duration** (*float in* *[**0**,* *inf**]*) – Duration, Haptic duration in seconds. 0.0 is the minimum supported duration.
            - **frequency** (*float in* *[**0**,* *inf**]*) – Frequency, Frequency of the haptic vibration in hertz. 0.0 specifies the OpenXR runtime’s default frequency.
            - **amplitude** (*float in* *[**0**,* *1**]*) – Amplitude, Haptic amplitude, ranging from 0.0 to 1.0

        Returns:
        :   Result

        Return type:
        :   boolean

    *classmethod* haptic_action_stop(*context*, *action_set_name*, *action_name*, *user_path*)
    :   Stop a VR haptic action

        Parameters:
        :   - **action_set_name** (*string**,* *(**never None**)*) – Action Set, Action set name
            - **action_name** (*string**,* *(**never None**)*) – Action, Action name
            - **user_path** (*string**,* *(**never None**)*) – User Path, Optional OpenXR user path. If not set, the action will be stopped for all paths.

    *classmethod* controller_grip_location_get(*context*, *index*)
    :   Get the last known controller grip location in world space

        Parameters:
        :   **index** (*int in* *[**0**,* *255**]*) – Index, Controller index

        Returns:
        :   Location, Controller grip location

        Return type:
        :   [`mathutils.Vector`](mathutils.html#mathutils.Vector "mathutils.Vector") of 3 items in [-inf, inf], (never None)

    *classmethod* controller_grip_rotation_get(*context*, *index*)
    :   Get the last known controller grip rotation (quaternion) in world space

        Parameters:
        :   **index** (*int in* *[**0**,* *255**]*) – Index, Controller index

        Returns:
        :   Rotation, Controller grip quaternion rotation

        Return type:
        :   [`mathutils.Quaternion`](mathutils.html#mathutils.Quaternion "mathutils.Quaternion") rotation of 4 items in [-inf, inf], (never None)

    *classmethod* controller_aim_location_get(*context*, *index*)
    :   Get the last known controller aim location in world space

        Parameters:
        :   **index** (*int in* *[**0**,* *255**]*) – Index, Controller index

        Returns:
        :   Location, Controller aim location

        Return type:
        :   [`mathutils.Vector`](mathutils.html#mathutils.Vector "mathutils.Vector") of 3 items in [-inf, inf], (never None)

    *classmethod* controller_aim_rotation_get(*context*, *index*)
    :   Get the last known controller aim rotation (quaternion) in world space

        Parameters:
        :   **index** (*int in* *[**0**,* *255**]*) – Index, Controller index

        Returns:
        :   Rotation, Controller aim quaternion rotation

        Return type:
        :   [`mathutils.Quaternion`](mathutils.html#mathutils.Quaternion "mathutils.Quaternion") rotation of 4 items in [-inf, inf], (never None)

    *classmethod* bl_rna_get_subclass(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The RNA type or default when not found.

        Return type:
        :   [`bpy.types.Struct`](bpy.types.Struct.html#bpy.types.Struct "bpy.types.Struct") subclass

    *classmethod* bl_rna_get_subclass_py(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The class or default when not found.

        Return type:
        :   type