Touch Rotate Bug.. Buildbox 3

Discussion in 'Buildbox General Discussion' started by mohamed awad, Feb 27, 2020.

  1. mohamed awad

    mohamed awad Avid Boxer

    Joined:
    Mar 10, 2019
    Messages:
    219
    Likes Received:
    102
    i have added Touch Rotate Node on character nodes direct connection with Start node
    it's work fine on Game Preview but When i export my game to android or ios and test it on real device, Touch Rotate method disappear as if I never add it..
    So, is there anyway to build this method without using Touch Rotate Node ?
    or fix this bug ?
    Buildbox 3.1.4....
     
    aminee and alp like this.
  2. alp

    alp Boxer

    Joined:
    Feb 27, 2020
    Messages:
    5
    Likes Received:
    1
    I am facing the exact same problem, and this is a huge issue I hope someone can come up with a solution.
     
  3. HueTheDev

    HueTheDev Moderator Staff Member

    Joined:
    May 11, 2017
    Messages:
    209
    Likes Received:
    79
    Weird, it should still work when exported. Other control inputs might override it, if used. Send in your .bbdoc to support@buildbox.com, so we could take a look at it.
    You could try connecting the rotate node using a full screen or bottom of the screen UI button.
     
  4. mohamed awad

    mohamed awad Avid Boxer

    Joined:
    Mar 10, 2019
    Messages:
    219
    Likes Received:
    102
    Already use everything possible and nothing worked
    But i change the touch rotate node script to anther rotate node found it on interstellar strike temp and it works
    here is the script

    ///
    let enabled = false;
    let scrX, scrY;
    let start, prev;
    let phys;
    let isTouched = false;
    let forward, right;
    let delta = new Vec3(0, 0, 0);
    let sens;

    function init() {
    this.enableTouch();
    smooth = this.attribute('Smooth');
    smooth = Math.max(0, Math.min(0.99, 1 - smooth));
    sens = this.attribute('Sensitivity');
    if(this.attribute('Invert X')) sens.x *= -1;
    if(this.attribute('Invert Y')) sens.y *= -1;

    scrX = Number(this.attribute('Screen X'));
    scrY = Number(this.attribute('Screen Y'));
    forward = new Vec3(
    scrY == 0 ? 1 : 0,
    scrY == 1 ? 1 : 0,
    scrY == 2 ? 1 : 0
    );
    right = new Vec3(
    scrX == 0 ? 1 : 0,
    scrX == 1 ? 1 : 0,
    scrX == 2 ? 1 : 0
    );


    phys = this.entity().physics();
    sens = sens.scale(0.025);
    if (phys && phys.type() != 'kDynamic') {
    phys = null;
    }
    }
    function update(dt) {
    if(!enabled) return;
    if (phys) {
    addAngVel(delta.scale(smooth));
    }else{
    let ent = this.entity();
    let nPos = ent.rotation().add(delta.scale(smooth));
    ent.setRotation(nPos.x, nPos.y, nPos.z);
    }
    delta = delta.scale(1 - smooth);
    }
    function signal(name, value) {
    enabled = value;
    }

    function getVelFromScreenMove(dx, dy) {
    return forward.scale(dy).add(
    right.scale(dx))
    }
    function addAngVel(vel) {
    setAngVel(vel.add(phys.angularVelocity()))
    }
    function setAngVel(vel) {
    phys.setAngularVelocity(vel.x, vel.y, vel.z);
    }

    component.touchBegan = function (pt) {
    isTouched = true;
    start = pt;
    prev = pt;
    }

    component.touchMove = function (pt) {
    if (!enabled) return;
    let dx = sens.x * (pt.x - prev.x);
    let dy = sens.y * (pt.y - prev.y);
    let vel = getVelFromScreenMove(dx,dy);
    delta = delta.add(vel);
    prev = pt;
    }

    component.touchEnded = function (pt) {
    isTouched = false;
    }
     
    aminee and alp like this.
  5. mohamed awad

    mohamed awad Avid Boxer

    Joined:
    Mar 10, 2019
    Messages:
    219
    Likes Received:
    102
    No NO
    absolutly no
    there is default touch rotate node on Control nodes and it works fine on game preview but not when export,
    the custom one works with no issues
    and Touch Node > Rotate Node doesn't work like touch rotate node....
     
    Last edited: Feb 29, 2020
    aminee and alp like this.
  6. Codifie

    Codifie Avid Boxer

    Joined:
    Apr 17, 2018
    Messages:
    331
    Likes Received:
    157
    3.1.4 has a Touch Rotate node under Controls
     
  7. alp

    alp Boxer

    Joined:
    Feb 27, 2020
    Messages:
    5
    Likes Received:
    1
    hey man i was trying this out but i am getting this error: JS Error [asset: Cube, component: Script, line: 0] - TypeError: sens is null
    I am a noob can't figure out why i get this. can you help me?
     
  8. alp

    alp Boxer

    Joined:
    Feb 27, 2020
    Messages:
    5
    Likes Received:
    1
    I am also using the already built in touch rotate node but it does not seem to work outside of Bb3 environment. I already seen some other discussions about it in the forum https://www.buildbox.com/forum/index.php?threads/touch-rotate-node-bugged.18380/
     
  9. HueTheDev

    HueTheDev Moderator Staff Member

    Joined:
    May 11, 2017
    Messages:
    209
    Likes Received:
    79
    Yes sorry, I overlooked the first post, but mohamed awad I'm glad you were able to get it to work. I'll still bring this issue up to the team.
     
  10. mohamed awad

    mohamed awad Avid Boxer

    Joined:
    Mar 10, 2019
    Messages:
    219
    Likes Received:
    102
    NP bro,
    i hope they solve it quickly,
    i have already contact with support about anther bug
    and still waiting....
     
    Last edited: Feb 29, 2020
    alp likes this.
  11. mohamed awad

    mohamed awad Avid Boxer

    Joined:
    Mar 10, 2019
    Messages:
    219
    Likes Received:
    102
    what is your BB version ?
     
    alp likes this.
  12. HueTheDev

    HueTheDev Moderator Staff Member

    Joined:
    May 11, 2017
    Messages:
    209
    Likes Received:
    79
    Version 3.1.4
    Build# 3502
     
  13. alp

    alp Boxer

    Joined:
    Feb 27, 2020
    Messages:
    5
    Likes Received:
    1
    mohamed awad ladies and gentelman we got a genuies. i solved the problem it was just connected wrongly. I am so glad that you share your solution, it was great help for me and lots of others I guess. cheers!
     
    mohamed awad likes this.
  14. mohamed awad

    mohamed awad Avid Boxer

    Joined:
    Mar 10, 2019
    Messages:
    219
    Likes Received:
    102
    alp Thanks bro.
    cheers!
     

Share This Page