I'm trying to create a game where the player is flying in an infinite tunnel in first person and they can control the tunnel's path in real-time. e.g if they press D, then the tunnel should turn to the right. I'm using Blender + Unity.

Here's a video of a game called Gyan: https://www.youtube.com/watch?v=E3fATScq9-8 It's a music game where you are flying in a tunnel and you have to dodge obstacles and collect coins. In my game, the tunnel is supposed to look simlar, but there will be no coins or obstacles. The only mechanic (for now) is that using WASD keys, you can control where the tunnel will turn next. (i'm only developing this game for myself for fun)

Problem: I don't know how to implement the desired game mechanics. I'm struggling mainly with how to take as input a key press from the player, and in real-time, render a tunnel that turns accordingly.

What I have tried so far:

  1. Create a cylinder in Blender, add loopcuts and import into Unity. Then, create a shader that transforms the vertices of the tunnel based on math functions.

    • How it went: I managed to make it work, but only without player input, and just using math functions for the displacement. With player input, the movement is just completely random, and I think implementing the math in the shader is going to be complicated.
  2. In Blender: using curves to create a tunnel mesh.

    • How it went: Blender makes it extremely easy to create the mesh for the tunnels. You can do all kinds of things with bezier curves in Blender. For example, I was able to make this tunnel mesh in less than 2 minutes in Blender, and it is a perfect example of what the path the player travels could be like. I encountered problems when I tried to add in player input (as Blender is not a game engine) enter image description here
  3. In Blender, creating a cylinder, and adding a bone structure to it. Then in Unity, using damped transform and the Animation Rigging package to make the cylinder deform automatically as it is moved. With this approach, it was easy to create the turns for the tunnel in Unity at run-time, from player input. The problems were with the rigging system and making the tunnel look good. For example, I initially created the bones as bendy bones in Blender, and they were literally perfect, but Unity doesn't support them, so I had to use normal ones, and thus, when I rotated it in Unity, the tunnel just didn't look good.

Additional notes: The description of the game right now is a little bit flawed: suppose the tunnel is straightforward for 20 meters, then you cannot suddenly turn left. So I haven't thought of the design fully through yet, but as I'm developing this game for myself and it's my first game, I don't think it's that serious.

  • \$\begingroup\$ Not having thought the design through is a serious issue. You can't make good technical decisions if you haven't thought the mechanics through. \$\endgroup\$
    – Kevin
    Commented May 13 at 0:48
  • \$\begingroup\$ #1 sounds like the most flexible approach to me. If you deform the pipe and scroll the texture, you can create the illusion of movement without having to dynamically add sections to the pipe. If you're stuck on the implementation, you can ask for help with the specific parts you're stuck on. \$\endgroup\$
    – Kevin
    Commented May 13 at 0:53

1 Answer 1


You could clone some prefabs for a straight tunnel in front of the player, and if player is pressing right (Input.GetKey(KeyCode.D)), create a clone of a pipe thats going right. Do this for all four directions and it should give you a good looking prototype.

  • \$\begingroup\$ Why would there need to be 4 prefabs when you could rotate one prefab in different directions? But this approach doesn't accommodate turning at different rates, or complicated paths like corkscrew, unless the developer makes a huge number of prefabs. \$\endgroup\$
    – Kevin
    Commented May 13 at 0:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .