Skip to content

MovementFunctions

Bastiaan Olij edited this page Feb 3, 2022 · 2 revisions

Introduction

If positional tracking is available the player can physically move through the world but is always constrained by the available physical space.

The XR tools library contains a number of movement functions that provide the player with the ability to move beyond their physical play space. These functions react to player controller input in one form or another. Our Teleport function is separate from the system discussed on this page.

At the core of these movement functions is a new node type called PlayerBody that handles the physics interactions as the player moves around the scene. On top of this various movement functions are implemented that move the player through the virtual world.

The first time Godot is started with the plugin it is possible for the classes to not be registered in time with the editor. Just save your project and reload it and the issue should sort itself out.

This page describes the PlayerBody node in more detail, for documentation of the various movement functions consult these pages:

Setup

If the PlayerBody node doesn't exist yet in your scene, adding any of the movement functions will add it automatically. If you want to manually add it to your scene it needs to be added as a child of your ARVROrigin node and it is recommended to add it after your camera and controller nodes.

Gravity is implemented in this logic so if you do not have a floor the player will keep falling.

The functionality works out of the box but can be further configured.

Configuration

Property Description
Enabled When ticked this node will controll the players movement.
Player Radius Sets the radius of the player collision shape that is used
Eye Forward Offset Defines how much forward the ARVRCamera is assumed to be from the center of the players head.
Gravity Gravity applied to the player.
Push Rigid Bodies If ticked the player will push rigid bodies away. If unticked the player will stop moving when colliding with rigid bodies.
Physics If set overrides the default [[physics settings

The Origin and Camera properties allow you to override which origin point this object controlls and which camera informs us of the location of the player. These will be removed soon as the node detects these automaticaly if placed correctly.

Clone this wiki locally