How to sweep by scaling a sphere?

I’m curious how to use SweepSingleByChannel. I see that it has a start and end vector, and a collision shape. I’m guessing it takes the collision shape and moves it between the start and end vector. For my purposes all I really need to do is have the sphere shape scale from zero to a designated size, this would determine if anything is within the radius of the sphere and return that. But when I just use a start location for both start and end, and set the sphere to the size I want I don’t get a return on it.

Unfortunately i cannot answer your question, but I have a similar one. I am looking for the exact same thing as you, so that I can have usefull Vectors, when a actor using physics is overlapping with a sphere. The event doesn’t yield usefull data, as the moving actor does not use sweep but rather physics itsself. Do you know some way to get usefull data out of that overlap event? Or maybe have the moving actor use sweep, despite being moved by the physics simulation?

try this video here, it’s Russian but you can copy some code: - YouTube

Can you post the code? The vid is private in 2023.

Depending on your need, just do it with a sphere that you shrink at runtime, is not visible, and correctly interacts with the proper collision channels.

Its easier than running the dedicated trace channel, even if it needs a bit more coding to define what it is you hit and keep track of it.

Best part, if you make it into its own blueprint you can attach it to anything as a child actor and it will just work/do its thing.

1 Like

Thanks for the reply. I wanted the vid to see what he was talking about lol.

But you are saying just use a normal Sphere collision, and scale it up and down (e.g. on a Timeline, 2 secs) - and that works as the expanding collision detection? - as long as the Collision channels that are setup in the Sphere, are what we want to use?

And do we need to check “Sweep” in the Transform/scale node?

  • (It is my understanding that we can change the scale of things with collision. But the engine wont constantly check collision hits during the scale transition (e.g. when it is 1.1 size, then 1.2 size and now it collides with something) - unless we check Sweep, correct?)

Depends, it could work without sweep being checked if the object is movable for instance.

1 Like