sphere trace by channel in c++

Hey GUys,

how do i implement functionality like:

i saw something like this: https://answers.unrealengine.com/questions/3446/how-would-i-use-line-trace-in-c.html but it seems to be different due to it’s line trace… any help?

1 Like

Sweeps can be done using SweepSingleByChannel / SweepMultiByChannel depending on if you want more than just the blocking hit.

Overlaps can be done using QueryOverlapsByChannel.

Both methods take in an FCollisionShape object which defines the shame. FCollisionShape has tons of static methods to help make various shapes (FCollisionShape::MakeSphere(…)).

Anytime you want to know “How does this blueprint method work?” Just search for the name of the method in code and you can find the exact C++ code it’s using.

3 Likes

any example code on how to use these functions?

Again, search the code base. There’s tons of examples (CharacterMovementComponent.cpp, CableComponent.cpp, EnvQueryTraceHelpers, etc). If you don’t have the full engine code, go download it - it’s great even if you use it just for reference.

Trying to teach you how to fish rather than giving you a fish. :slight_smile:

it’s good, but maybe half fish is better at start :slight_smile: where is that code base? if you refer to engine code i think i can look from visual studio at it but it it’s some web site/page i can try google.

Engine code, so open it in Visual Studio and just search for “SweepSingleByChannel”.

thanks, good fish!