PADClampCircle

Syntax

#include <cafe/pad.h>

void PADClampCircle(PADStatus* status);

Parameters

status Array [PAD_MAX_CONTROLLERS] of PADStatus objects to be clamped.
If the err member is PAD_ERR_NONE, the analog stick input value is clamped according to the algorithm below.

Return Values

None.

Description

This function clamps the analog stick inputs. This function takes an array of PADStatus types as an argument. The number of elements in this array is determined by PAD_MAX_CONTROLLERS. PADClampCircle clamps all PADStatus at the same time.

This differs from PADClamp in that the analog stick is clamped within a circle rather than an octagon. Since clamping to a circle results in a consistent, maximum speed regardless of the stick direction, this may be important if the stick value is used for controlling a character's speed. Although this makes the range narrower than that from PADClamp, that compromise allows for a fixed maximum value to be achieved. An accurate comparison of the two clamping range types for the controller stick is given below. (The same figure applies to the C Stick.)

padclampcompare.gif (4793 bytes)

Clamping Algorithm (analog sticks): PADClampCircle performs dead-zone and outer-circle clamping for analog sticks as illustrated below. For the Control Stick, this function first clamps the deadzone (±15) along both axes, and then clamps an outer circle having a radius of 56. For the C Stick, this function first clamps the deadzone (±15) along both axes, and then clamps an outer circle having a radius of 44.

padclampcircle.gif (16747 bytes)

Clamping Algorithm (analog trigger): PADClampCircle clamps the dead zone (0 to 30) and outer zone (180 to 255) of the analog trigger. The trigger return value is between 0 and 150.

Do Not Call From

Background Do not call this function from the background.
Production code Do not call this function in production code. It is available only for debugging purposes.

See Also

PADRead
PADStatus
PADClamp

Revision History

2013-05-08 Automated cleanup pass.
2011-02-03 Initial version.


CONFIDENTIAL