3D Endless Runner , adding Turns

This is my first question …
I am a high school student developing a 3D endless runner game with Unity Engine 5.
I have my platform moving in straight line so it seems so boring hence I decided to add turns in my Endless Runner.
Please explain how i can achieve this .
ie ** Adding Turn in my game. **
Thanks in advance

I’ll assume you’re looking at this from the perspective that an endless runner involves running from left to right and , therefore, on the X axis.

By that logic, I would presume you’re having your character move to the right (positive X) and jumping sends your character up (positive Y) to then fall back down. Without an example to go on, I’ll also assume you’re utilizing the physics engine, so my example below will be based around a Rigidbody for movement.

Based on that assumption, adding a third dimension should actually prove quite simple.

Define your horizontal and vertical axis separately, then have the character move on them independently. As an example of that:

// C#
Vector3 horizontalAxis = Vector3.right; // positive X default
Vector3 verticalAxis = Vector3.up; // positive Y default

// ...

// Assuming Rigidbody is used, treated as variable rb
rb.velocity = (horizontalAxis * currentHorizontalSpeed) + (verticalAxis * currentVerticalSpeed);

With this concept in mind, your direction of movement can be changed freely, based on the terrain. When you want to round a corner, you could change the direction to a right-angle, or any angle you please. With a little adjustments to the application of physics (i.e. handling it through a script rather than using global settings), you could also bend and twist gravity to your whims!

Learn more. Experiment more. Push your game to the limits, then say “To Hell with this!” and redefine those limits yourself.