Dynamically scale a hitbox between 2 irregularly moving points.

You can just cast sphere traces on those 2 points and see what’s going on. If the component’s rotation is wrong, just check the viewport and see if your collision box’s placement matches with the mesh in my screenshot.

Additionally, let me explain how to math works so you can understand what we’re doing here. We’re just locating the component on one of the points, then subtracting the other point from that one to get a vector that doesn’t define any location but shows the direction of the second point according to the first one with the magnitude, and setting it to the scale value of the component. The reason where the component is around the scene root matters is because the scale value sets the other point of the the space diagonal according to the world location.

I’ll send you the exact code for your case later. Until then, see if you can make sense of my explanations.


Hey there @teradore, I just got on my PC. Here’s the exact code for the collision component, it’s a bit different:

And here’s the result:

As you can see, the collision volume moves independently of the actor and it adjusts itself to the points. This was the objective right?

Hope this helps! :innocent: