Set Move Distance

Discussion in 'How Can I...?' started by Matthew Woodhouse, Apr 24, 2020.

  1. Matthew Woodhouse

    Matthew Woodhouse Boxer

    Joined:
    Apr 19, 2020
    Messages:
    8
    Likes Received:
    3
    Hey Boxers,

    Is there a way to have character move a set distance on x-axis when a button is pressed, I'm trying to have a question displayed at top of screen and 2 possible answers underneath, when correct answer is pressed character will walk/fly/swim to next scene.

    Thanks guys
     
  2. Codifie

    Codifie Avid Boxer

    Joined:
    Apr 17, 2018
    Messages:
    364
    Likes Received:
    190
    I haven't played with this, but pretty sure you are going to need a script to accomplish your idea. My first thought is something like the code below placed into the update function in a new script that could be triggered as a custom button possibly. You would need to pass it a variable into the setPosition.
    Not sure how well this would work and would need more code based on your specific circumstance, sadly I just don't have the time to play/prove out the code.

    Code:
    let pos = this.entity().position();
    
    this.entity().setPosition(
                pos.x,
                pos.y,
                pos.z);
     
    Last edited: Apr 24, 2020
  3. Codifie

    Codifie Avid Boxer

    Joined:
    Apr 17, 2018
    Messages:
    364
    Likes Received:
    190
    And another idea, no code, would be to use the Move Node and Position Limit Node. This way you can limit the movement each time the Move node is triggered.
     

Share This Page