Edge Grabbing- Trace or Collision?

Hi all
I’ve been making a basic-ish 3D platformer, and it’s got to the stage where I’m going to implement a ledge grabbing mechanic.
I’m not looking for anything too in-depth; I pretty much plan to have the player grab a ledge when you hold a button while falling (similar to Tomb Raider), so when you let go of the button you’ll fall, and when you press jump, you’re launched up into the air. However I don’t plan to have any ledge climbing/shimmying, so it’s not overly complex. You simply grab, and your options are to either jump up, or drop down; no side to side movement.

I’ve been looking up the video tutorials by Crocopede and the work Alex3d did in the past where they use trace by channel/ trace for object methods, but I’ve also seen the easier method with colliders manually placed around geometry which might be all I need for my basic level of edge detection. From my basic knowledge, the trace methods would be good, but I don’t know if it would work on floating moving platforms as I don’t know if it would trace for a floating ledge above the player. And regarding colliders, I don’t know if it’ll work on moving objects as they’d surely need to be a child of the actor but might be a bit weird. In short, the moving platforms are kind of key to making the right decision for the whole mechanic

Does anyone have any helpful advice for this or what might be the best course of action before I get too bogged down in the wrong direction. And if I go with traces, what’s the key differences/pros & cons between Crocopede’s trace channel, and Alex3d’s trace for object?


You could use 2 raycasts (trace channel / trace for object doesn’t matter really much). One in front of your characters face, and one a little bit above.
If the first one is blocked, and the 2nd one isn’t -> ledge.
So you don’t have to place extra climb objects. But you have to be carefull with your level design.

That makes a lot of sense now I think about it, as it’ll be able to trigger provided that floating ledge isn’t too thin, I’ll have to make sure my platforms have a decent enough height/thickness to them.

I had a play around with raycasting using Crocopede’s tutorials and it works fairly well barring a few problems that I will probably address later on, or I’ll rebuild the whole trace process to something a little more specific to my plans. However it doesn’t seem to collide with my moving platforms. The moving platform is an actor Blueprint with a floor static mesh, which is set to a worlddynamic object type, and the trace should pick this up. Is there something I should set here in order for a trace to pick up a mesh within a BP?
I can provide images if need be later on

You could play around with different collision channels for your moving platforms that would trigger it regardless. A quick-stop fix at the least.

Or post your raytrace code and your settings :slight_smile:

My code follows crocopede quite closely. First of all the BP runs a trace to find a wall when it’s within range, then once it hits, it finds the ledge height, and records a couple of the return values.
The macros for the wall trace, where the trace comes out of around the chest of the character (hence the +50 float on Z)
And then the ledge trace
After which, it checks to make sure you’re not already hanging, then attaches the player to the wall using the recorded wall normal as the rotation, and the location and height of the ledge, and also stops movement so you can jump but can’t slide about.
I then have a sphere collider that checks for worldstatic and worlddynamic objects, but this doesn’t pick up the moving platforms, these are the settings of the collider
The cubes I have in my scene block the tracer, as does the floating platform meshes, but only the cubes work.

I do plan to redo the tracing to work as you suggested KrautPotato, but I’m still relatively new to raycasts so I want to fully understand the functionality of them before I experiment