PADClampCircle

Syntax

#include <revolution/pad.h>

void PADClampCircle(PADStatus* status);

Arguments

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

Return Values

None.

Description

Clamps the inputs of the controller analog stick inputs. The PADClampCircle function takes an array of PADStatus-type structures as an argument. The number of elements in this array is indicated by PAD_MAX_CONTROLLERS. PADClampCircle clamps all PADStatus once.

A point of difference with the PADClamp function is that the analog stick is clamped within a circle rather than an octagon. Since clamping in a circle results in a consistent, maximum speed regardless of the stick direction, this fact may be important if a character's speed is being controlled using the stick value. Although clamping is performed in a narrower range than PADClamp, it represents a suitable compromise to achieve a fixed maximum value. An accurate comparison of the two types of clamping range 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. This function first clamps the dead zone (±15) along both axes, and then clamps the outer circle having a radius of 56. This function first clamps the dead zone (±15) along both axes for the C stick, and then clamps the 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 buttons. The trigger return value is between 0 and 150.

See Also

PADClamp, PADInit, PADRead, PADStatus

Revision History

2006/03/01 Initial version.


CONFIDENTIAL