Unreal 4.20.0 How do I check for collision with wall left and right, for wall jump? (2d platformer)

Hi :)

I am using Blueprint and I would like to check from my player object to the left wall and the right wall of the level in order to wall jump.

Here is a screenshot of what the level looks like. I used a Tile Map to make the level.
image

Any help is appreciated :)

Comments

  • I haven't UE in a while, but I'd imagine the thing you'd be looking for is LineTrace (or BoxTrace, or any of the other tracing equivalents). Those would tell you if there's an object in the direction you're tracing in at a given distance.

    The things you're tracing against would need some kind of collision component on them (probably a box collision this case).
    Thanked by 1Jurgen
  • @Elyaradine, great, thanx for the reply :)

    I managed to use LineTraceForObjects and it worked :D
    image

    Here is an screenshot of what I wanted to achieve:
    image

    A line is drawn from the player to the left and when it hits the wall it registers a collision, changing colour.
    Screen_shot_02.png
    1107 x 691 - 147K
    Screen_shot_03.png
    1296 x 744 - 465K
  • Out of interest, is there a reason you're using UE instead of GameMaker if you're making a 2D game? I seem to remember your using GM in the past, and afaik it has a more comprehensive toolset than UE for 2D work.
    Thanked by 2pieter Jurgen
  • @Elyaradine, yeah :) I have been wanting to make a 3D game for a long time and at the moment I'm getting to know UE a bit better. I'm also looking for new possibilities and outlets :) I think getting to know the engine can yield exciting results in future :)

    Currently I want to see what I can do 2D wise in UE, GameMaker's gml is something I don't know well enough to express myself fully. I also like the idea of visual scripting that UE's Blueprint offers.

    Here is an article on 'The Siege and the Sandfox' I found interesting:
    https://80.lv/articles/the-siege-and-the-sandfox-pixel-art-game-with-ue4/
  • For those interested :)

    image

    I have been using a TileMap in UE for my level. The LineTrace I did checked where the player collided with it ito a horizontal line. The problem was it registered the whole map instead of only the walls. Then I put a new sprite in the level, declared it to BlockAll (then being a WorldStaticObject) collision-wise.

    I couldn't figure out how to wall-jump when the player and the traced object collided themselves so I got to the implementation in the image.
    Now, the player, depending on its velocity when jumping against the wall object bounces away with an 'up' and horizontal' value added. Ito axis direction the bounce is in the opposite direction :)
    Screen_shot_04.png
    1095 x 431 - 136K
Sign In or Register to comment.