Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Turning a Platformer into 3D

Im making a game with the old "Make A Game" brackeys tutorial as reference.

Right now, the player can move in the XY plane like a usual platformer. I want to add an extra dimension by switching the movement plane from XY to ZY after reaching certain points within a level. That is, upon reaching a certain point I want to rotate the camera 90° and then have the player move left and right.

What is the best approach to solve this problem, given that I have currently restricted all rigidbody movements in the Z axis? Also, the movement script adds relative torque in the X axis. How would I make it adapt to Z and X axes depending on the current active plane?

Best Answers

  • Roby65Roby65 Member
    Accepted Answer

    I would go with a trigger where you have to switch to 3D.

    That trigger, should:

    - Disable the Z axis restriction

    - Move the camera

    - Handle the input differently (now left - right will move on the z-axis instead of the x-axis)

  • Roby65Roby65 Member
    Accepted Answer

    I would:

    • Declare a public variable in the character controller, for example "bool is3DMovement"
    • If that boolean is true, check for the YZ plane movements, else the old XY movements
    • On trigger enter, get the character controller instance and set is3DMovement to true

    Let me know if I am not clear enough 😉

Answers

  • @Roby65, could you please elaborate how I should script the different input functions? And if I have two functions for XY and XY planes, how do I switch between them inside a script?

    Many thanks in advance 😊🤗

  • @Roby65 thanks a lot. 🤘🤗🤗

Sign In or Register to comment.