Joystick Button Not Aligned With Joystick Active Coordinates

Discussion in 'How Can I...?' started by Cally Wolk, Mar 12, 2021.

  1. Cally Wolk

    Cally Wolk Boxer

    Joined:
    Mar 3, 2021
    Messages:
    7
    Likes Received:
    0
    My joystick works fine in my preview window until I go full screen with my preview window...then suddenly the active joy coordinates are several inches to the left of the actual joystick button. It still works, but I have to click over on the left to get the thing to work. I exported the game and the problem remains.

    Please check out the attached short video. I welcome any suggestions, as this has eluded me for over a week of struggling with it. Many thanks.



    Here is the script for the brainbox Mobile Controller:

    let maxValue = 200;

    let sensitivity = 0;



    let keyboardOverride = false;

    let enabled = false;

    let outVec = new Vec2(0,0);



    let platformerMovementRef;

    let platformerJumpRef;



    function init(){

    sensitivity = this.attribute('Sensitivity');

    maxValue = maxValue/sensitivity;



    platformerMovementRef = this.entity().component('Advanced 3D Movement');

    platformerJumpRef = this.entity().component('Advanced Jump');



    if (!platformerMovementRef){

    warning('Animated Platformer Brainbox not found, please add the Brainbox to fix this issue!');

    }



    if (!platformerJumpRef){

    warning('Animated Platformer Brainbox not found, please add the Brainbox to fix this issue!');

    }

    }



    function start(){



    }



    function update(dt){

    if (enabled && platformerMovementRef && !keyboardOverride){

    platformerMovementRef.signal('x', outVec.x);

    platformerMovementRef.signal('y', outVec.y);

    }

    }



    function signal(name, value, sender){

    if (name == 'Joystick'){

    outVec.x = value.x/maxValue;

    outVec.y = -1*value.y/maxValue;



    if (outVec.length().toFixed(2) > 0){

    enabled = true;

    }

    }



    if (name == 'Enabled'){

    enabled = value;

    }



    if (enabled && !keyboardOverride){

    if (name == 'Run' && platformerMovementRef){

    platformerMovementRef.signal('Run', value);

    }



    if (name == 'Jump' && platformerJumpRef){

    platformerJumpRef.signal('Trigger Jump', value);

    }

    }

    }



    function requested(name, arg, sender){

    return this;

    }



    component.enabled = () => {return enabled}

    component.keyboardOverride = (value) => {keyboardOverride = value}
     

Share This Page