mirror of
https://github.com/DrBeef/JKXR.git
synced 2025-06-02 18:01:16 +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;
|
static float lastFrameTime = 0.0f;
|
||||||
float timestamp = (float)(Sys_Milliseconds( ));
|
float timestamp = (float)(Sys_Milliseconds( ));
|
||||||
float frametime = timestamp - lastFrameTime;
|
float frametime = timestamp - lastFrameTime;
|
||||||
|
|
|
@ -84,14 +84,14 @@ float nonLinearFilter(float in)
|
||||||
float val = 0.0f;
|
float val = 0.0f;
|
||||||
if (in > NLF_DEADZONE)
|
if (in > NLF_DEADZONE)
|
||||||
{
|
{
|
||||||
val = in;
|
val = in > 1.0f ? 1.0f : in;
|
||||||
val -= NLF_DEADZONE;
|
val -= NLF_DEADZONE;
|
||||||
val /= (1.0f - NLF_DEADZONE);
|
val /= (1.0f - NLF_DEADZONE);
|
||||||
val = powf(val, NLF_POWER);
|
val = powf(val, NLF_POWER);
|
||||||
}
|
}
|
||||||
else if (in < -NLF_DEADZONE)
|
else if (in < -NLF_DEADZONE)
|
||||||
{
|
{
|
||||||
val = in;
|
val = in < -1.0f ? -1.0f : in;
|
||||||
val += NLF_DEADZONE;
|
val += NLF_DEADZONE;
|
||||||
val /= (1.0f - NLF_DEADZONE);
|
val /= (1.0f - NLF_DEADZONE);
|
||||||
val = -powf(fabsf(val), NLF_POWER);
|
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
|
//Apply a filter and quadratic scaler so small movements are easier to make
|
||||||
float dist = length(pSecondaryJoystick->x, pSecondaryJoystick->y);
|
float dist = length(pSecondaryJoystick->x, pSecondaryJoystick->y);
|
||||||
float nlf = nonLinearFilter(dist);
|
float nlf = nonLinearFilter(dist);
|
||||||
float x = (nlf * pSecondaryJoystick->x);
|
dist = (dist > 1.0f) ? dist : 1.0f;
|
||||||
float y = (nlf * pSecondaryJoystick->y);
|
float x = nlf * (pSecondaryJoystick->x / dist);
|
||||||
|
float y = nlf * (pSecondaryJoystick->y / dist);
|
||||||
|
|
||||||
vr.player_moving = (fabs(x) + fabs(y)) > 0.05f;
|
vr.player_moving = (fabs(x) + fabs(y)) > 0.05f;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue