---
name: "SDL_SetHapticAutocenter"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_SetHapticAutocenter"
---

# SDL\_SetHapticAutocenter(3)

Set the global autocenter of the device.

## NAME

SDL\_SetHapticAutocenter - Set the global autocenter of the device.

## HEADER FILE

Defined in SDL3/SDL\_haptic.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**bool SDL\_SetHapticAutocenter(SDL\_Haptic \*haptic, int autocenter);**

## DESCRIPTION

Autocenter should be between 0 and 100. Setting it to 0 will disable autocentering.

Device must support the  **SDL\_HAPTIC\_AUTOCENTER**

feature.

## FUNCTION PARAMETERS

- *haptic*

  the  **SDL\_Haptic**\
    device to set autocentering on.

- *autocenter*

  value to set autocenter to (0-100).

## RETURN VALUE

Returns true on success or false on failure; call

**SDL\_GetError** () for more information.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_GetHapticFeatures**(3)](/SDL_GetHapticFeatures/3.md)
