Forward-backward movement

Contents

    Make a player move forwards and backwards using character controls in Flock XR. Use the camera to change direction.

    Start with a player

    Make sure that your project has a character that you would like to be the playable character

    Make a note of the playable character’s name. A good name is ‘player’

    Make the camera follow the player

    From Transform open Physics and add the add physics block under the add player block

    Check the block says add physics [player] type [dynamic]

    Your player character can now react to physics in the 3D world

    From Scene open Camera and drag the camera follow block under the add physics block

    Press Play ▶️ and notice that the camera is now behind the player

    Optional: If you would like to see the front of the player at the beginning of your project then check the ‘front’ box on the camera follow block

    Press Play ▶️ again to see the difference.

    Optional: If your camera is too close or too far away then you can use a different number in the radius part of the camera follow block

    Move the player forwards

    From Events add a Forever block to the code area

    From Condition add an if block inside the forever block

    From Sensing add the forward block to the shadow block on the if

    The forward block senses whether a controller has forward active. This might be a W on a keyboard, and an up arrow on a touch screen or a forward button on a controller.

    From Transform open Physics and drag the move [player] [forward] speed: 3 block inside the if

    Press Play ▶️ and press W on your keyboard or tap the up arrow on a touch screen

    From Animate drag the switch animation block under the move player block

    Change ‘Idle’ to ‘Walk’

    Press Play ▶️ and press W on your keyboard or tap the up arrow on a touch screen. The player now moves forward with a walk animation.

    Press Play ▶️ again and use your mouse to move the character and change the forward direction. On a tablet you will need to tap on the screen.

    Move the player backwards

    Right-click on the forward block and choose Duplicate

    Take the duplicated block and place it on top of the original forward block

    An else if appears.

    Drag the block to the shadow block and change the drop-down to backward

    Duplicate the move block and place it under backward

    Change the speed to -3

    Duplicate the switch animation block and place it under the move block

    Press Play ▶️ and press S on your keyboard or tap the down arrow on a touch screen. The player now moves backward with a walk animation.

    Go back to Idle animation

    When the player isn’t walking it needs to have an Idle animation, otherwise it will always be switched to the walk animation.

    Duplicate the switch animation to block

    Drag the duplicated block to the end of the if block until an else appears and drop the block inside the else

    Change the animation to ‘Idle’

    Press Play ▶️ and test the movement of your player. It should be idle when nothing is pressed and it should move forward and backwards when those are active (e.g. W or S is pressed)

    Updated on December 17, 2025