Real 3D Plaformer possible?

0 favourites
  • 7 posts
From the Asset Store
Scrollbars with FULL functionality and versatility, just like the ones you can find in AAA games!
  • Hi,

    I was trying the platformer template https://editor.construct.net/#open=gravity-portal

    Currently collisions happen even if z elevation of two objects are different. I checked and found this...

    I am wondering if it is hard to add a z collision check box to an object's property? This will make the game not only look 3d but work in 3d as well...

    Please let me know if i am missing something here... or if a workaround is available.

    Thank you

  • Workaround - check if z elevation is in between z elevation of target height of target and overlapping at base.

    Or use a proper 3d engine if you're making an actual 3d game.

  • The demo you linked to doesn't actually need 3D collisions - it's a great demonstration of 2D gameplay, using the existing behaviors and 2D collision detection, with some 3D graphics.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • strawberrypunch.com 3D platformer let'S gooooo

  • Depending on how deep you want to go you can get 3d collisions with a bunch of math.

    Using oosyrag's idea you can see if two boxes also overlap on the z axis with:

    box1 is overlapping box2 
    box1.z>box2.z-box1.depth 
    box1.z<box2.z+box2.depth 
    -- do something

    Or if you want to find the next box below the first box:

    box1 is overlapping box2 
    box2.z<box1.z+box2.depth 
    pick box2 with highest z 
    -- do something

    Pseudo logic of utilizing that could be:

    move on z axis 
    if overlapping in 3d: move up 
    move on xy 
    if overlapping in 3d: move backwards

    More finesse is needed to make it smooth. To have wall sliding or some more robust collision response you'd need SDFs(signed distance fields) or SAT(separating axis theorem) or probably some simplification of those.

    Heightmaps are also a technique to do terrain. You just need either a function that gives a height for an xy position. That can be done either with some equation or sampling an array of values with interpolation or sampling from a noise function.

    After that it can get a lot more complex. In general a good practice is trying to to do collision detection and response in 2d first with just events or js. Most of the ideas do carry over. Overall it may be more involved than most want to deal with.

    Here's a possible example of being able to jump on and go under 3d blocks. There was more nuance than I anticipated, but maybe it's useful.

    dropbox.com/s/4j93hionaa1c6qn/simple3dplatformer.c3p

  • check if z elevation is in between z elevation of target

    Depending on how deep you want to go you can get 3d collisions with a bunch of math.

    I tried collision checks as a workaround, it works, just not with "platformer", i had to use "physics" instead to simulate the movements.

    (PS : I think you linked the wrong file. )

    The demo you linked to doesn't actually need 3D collisions

    I tried https://editor.construct.net/#open=first-person-platformer as well, but it also uses a lot of coding workarounds for simulating platformer.

    This is what i had in mind. A real 3d platformer, where we can interact with physics. (Use m button to toggle views, PS : I do not know how to change the camera angle.)

    https://drive.google.com/file/d/1fhXyPt8FEGfpBZe4q2SgjWXauPYpE3ic/view?usp=sharing

    I had to trial and error for this to work. I think two amendments are needed in C3, one is to make "platformer" and "solid" compatible with physics. The second is to check z axis for collisions. And we can get a complete 3d engine (without any workarounds), if i am not wrong...?

    PS: Another addition could be an option to change physics & platformer direction to z axis?

  • Ah. Yeah I did link the wrong file. Fixed now.

    It uses the 8-direction movement and does the z axis movement with events. It toggles the solid behavior as needed and checks what blocks are above and below the player to handle z-axis collisions.

    Camera controls are completely independent of this. So I didn’t move it at all.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)