mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-22 04:01:33 +00:00
Fix for Pico thumbstick movement & fixed typo
This commit is contained in:
parent
f0a6d673ee
commit
dad5ed29f7
3 changed files with 6 additions and 5 deletions
|
@ -595,7 +595,7 @@ void TBXR_Vibrate( int duration, int chan, float intensity )
|
|||
}
|
||||
}
|
||||
|
||||
void TBXR_processHaptics() {
|
||||
void TBXR_ProcessHaptics() {
|
||||
static float lastFrameTime = 0.0f;
|
||||
float timestamp = (float)(Sys_Milliseconds( ));
|
||||
float frametime = timestamp - lastFrameTime;
|
||||
|
|
|
@ -84,14 +84,14 @@ float nonLinearFilter(float in)
|
|||
float val = 0.0f;
|
||||
if (in > NLF_DEADZONE)
|
||||
{
|
||||
val = in;
|
||||
val = in > 1.0f ? 1.0f : in;
|
||||
val -= NLF_DEADZONE;
|
||||
val /= (1.0f - NLF_DEADZONE);
|
||||
val = powf(val, NLF_POWER);
|
||||
}
|
||||
else if (in < -NLF_DEADZONE)
|
||||
{
|
||||
val = in;
|
||||
val = in < -1.0f ? -1.0f : in;
|
||||
val += NLF_DEADZONE;
|
||||
val /= (1.0f - NLF_DEADZONE);
|
||||
val = -powf(fabsf(val), NLF_POWER);
|
||||
|
|
|
@ -696,8 +696,9 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
//Apply a filter and quadratic scaler so small movements are easier to make
|
||||
float dist = length(pSecondaryJoystick->x, pSecondaryJoystick->y);
|
||||
float nlf = nonLinearFilter(dist);
|
||||
float x = (nlf * pSecondaryJoystick->x);
|
||||
float y = (nlf * pSecondaryJoystick->y);
|
||||
dist = (dist > 1.0f) ? dist : 1.0f;
|
||||
float x = nlf * (pSecondaryJoystick->x / dist);
|
||||
float y = nlf * (pSecondaryJoystick->y / dist);
|
||||
|
||||
vr.player_moving = (fabs(x) + fabs(y)) > 0.05f;
|
||||
|
||||
|
|
Loading…
Reference in a new issue