Able Ability System Info and Support Thread

Hello! Is there any way to configure a raycast query to also return the Physical Material in the FHitResult?

I’m seeing it returned by default. Does the component you’re hitting (or trying to hit) not have it enabled under Collision?

I’m using 2D cones without issue, even with an FOV of 110. Is this a 3D query we’re talking about?

Update: 3D cones do seem to produce some weirdness, @. Screens here: Imgur: The magic of the Internet

Pretty sure that’s just a visual bug, I tracked it initially but got swept up in other things. I’ll take a peek again.

Thanks for the reply. But I believe yes, I tried checking for the collision properties for both actors, skeletal meshes and static meshes and the physical surface seems to always be empty.

But also, I created a simple trace from my player Blueprint and the Physical Material is returned normally from that one.

Not sure what I’m missing here! =(

Didn’t have a whole lot of time to test earlier, but having spent a few minutes on it now, it looks like 3D is just broken. Debug logs for 2D and 3D below, same ability, just with the toggle flipped.

Sorry, I misspoke earlier. I meant to say it’s a part of the returned hit struct, not that values are being passed inherently. I did some experimentation with returning physical materials some time ago and found it to be a bit of a pain. It looks like, since they are Objects, Able Abilities don’t have direct access to some of the things you need to make this work, so take a look at the screenshots here: Imgur: The magic of the Internet

Hmm, 2D and 3D use the exact same code under the hood (except 3D has one extra check for height). I’ll dig into it. What FOV are you using in your test?

Captured some video. I can throw it in Dropbox or something if the quality is a problem, but it’s just me scrubbing the FOV value back and forth, toggling 2D on midway through.

And now there’s a clean 4.26 project here: https://drive.google.com/file/d/1AzI…ew?usp=sharing

There’s a really interesting “stepper” sort of behavior going on that repeats over the FOV range of 1-179.9. More screens: Imgur: The magic of the Internet

Yea, that’s the visual behavior I was talking about. That draw method is junk (it uses the engine’s draw cone - but something is off there or I’m passing it the wrong parameters), so I just need to write my own (which is what I did for 2D). Also one reason why a 2D query may find something, but 3D doesn’t, is because the height check goes against the player’s location (meaning their feet). so, if your location is outside of that cone (too close for example), despite that your body may be inside it - it would fail.

So if I’m understanding this correctly… assuming two character descendants in the transaction, the 3D cone is only going to detect a collision with what amounts to its leading bottom edge, and only if the other character’s location is a point on that line?

E.g., Scotty stands at 0,0,0 and projects a cone (500 FOV, 100 length) forward, and it only detects if is standing at 100,0,0?

Or would the same cone catch jumping in place from say, 90,0,0?

Silly question, answered it myself.

Something purpose-built probably isn’t a bad idea. The obvious workaround that comes to mind would be a primitive attached somewhere center-mass for responding to 3D cones, possibly on their own channel, but that doesn’t strike me as particularly scalable.

500 FOV is slightly meaningless as it’s going to get wrap around to 0 - 360 (so, 500 would 140 degrees). It should catch either of your examples, but if the “” character was close (say 20 units away), I could definitely see the cone missing that as that cone expands along the length (but 2D would grab it).

Yeah, definitely should’ve been “height” instead of “FOV” there. Tunnel-vision bit me on that.

This has been super informative, though. I’ve only been working with 2D cones until now, and it definitely would’ve thrown me for a loop whenever I got into 3D.

Again, I’ll double check. But when I did a pretty exhaustive look at 3D cone a few weeks back - the math was always correct and it was always my assumption of where the player was in relation to that cone that was wrong (e.g., I move the character back just a tad and it hits it). The fact that the Debug Draw is totally wacky doesn’t help show that fact, so I’ll definitely re-write that portion.

Ah gotcha! And thank you for uploading those images too.

Having the interface approach is not totally feasible in this scenario as this hitscan is used for bullet impacts and it could hit simple meshes too, not just actors. To support that, I created a method in a Blueprint Function Library that would do the material extraction as you suggested.

But I noticed that the the Face Index is coming up as “-1”, on both approaches - interface or function library.

This is also a parameter that you could provide to your hitscan, via FCollisionQueryParams (parameter “bReturnFaceIndex”). This is also similar to the physical surface (“bReturnPhysicalMaterial”), but these are not exposed in the Able Editor.

I’m considering creating a custom ray trace task for this context, but I still feel I might be missing something as it would be odd that such simple things wouldn’t be available OOTB. And as you said, it seems that you have a working solution, right?

In any case, thanks again for the help! :slight_smile:

If you see something not exposed in Able it’s generally because 1.) I don’t use it in my own projects, or 2.) No one asked yet. It’s trivial to expose those and I have some outstanding work to do in Raycast Task anyway, so I’ll toss these in as well. :slight_smile:

Ah that’s great, thank you for the info! Makes sense.

So, to summarize what I’m seeing right now, the ablRayCastQueryTask performs the traces between lines 75-103, where 1 out of 4 traces will be executed depending on the task setup. They all use a version of the trace calls from the World class, using 4 arguments.

The 5th argument that’s being omitted would be a FCollisionQueryParams with the flags above. The default version of this struct that’s being used is initialized with those flags set to false.

I didn’t mean to say it needed to be double-checked, just that I meant to say “height” where I said “FOV”. I was agreeing with you, I just didn’t communicate that very clearly. My bad.

The height of 500 was to ensure it’d be tall enough at the far extent to hit a roughly six foot tall humanoid’s root position, assuming both are standing on the same plane at roughly the same elevation. I goofed and said nonsense instead.

Yep, that’ll do it, I’d think.

As for doing this on standalone meshes, would it not make more sense to query the shooter about the gun and ammo type fired in the bullet impact scenario you mentioned, rather than how the wall responds to specific stimuli? If the brick wall is the same brick wall whether you shoot it with a watergun or an RPG-7, then in my mind, it seems reasonable to do the VFX/SFX handling in the context of the shooter/weapon/ammo, with consideration for the brick material of the wall.

There are other use cases, I’m sure. I’m just spitballing at this one, as it were.

You’re all good, soctty. I didn’t take any offense or anything. It was more “huh, yea, I’ve seen this before and this is what it normally is”. Intent is hard to read over the internet. :slight_smile:

Yeah, absolutely! Maybe I explained poorly, but here’s what I’m doing:

  1. The weapon actor has an ability that ray traces for hits;
  2. Once it hits something, whatever it is, it gets the Physical Material from it;
  3. It then queries a DataTable, to get a struct from that PhysMat surface. It contains the SFX/VFX to be rendered on that impact.

Still, each actor, static mesh or skeletal mesh hit has its own Physical Material assigned which needs to be fetched on that weapon’s hitscan, But it really seems that - at least OOTB - the Face or PhysMat really isn’t available.

But generally speaking, yes, the weapon actor handles all the spawning and so. It just needs to know the Physical Material that it hit.