How to determine which side of a buildable a line trace hit
I know I can do
hitResult.ImpactNormal.Z
to determine if I hit the top of a buildable, but doing hitResult.ImpactNormal.Y
will give different results based on how the buildable is rotated. Is there any way I can determine "This hit the left side"?Solution:Jump to solution
I do it like this, if you want to do the switch on enum thing use
EFoundationSide
8 Replies
I was able to get it working* by doing this:
Not sure if this is the correct way, though
Solution
I do it like this, if you want to do the switch on enum thing use
EFoundationSide
You can also use the Transform to convert the normal into local space for the hit object.
I have a slotted buildable hologram that can determine the hit face of a hitbox
I got the original info from here
https://forums.unrealengine.com/t/how-to-determine-a-cubes-right-left-etc-through-line-trace/369185
The game probably already has a function to do this for foundation snapping but I never found it
Somewhere in here: https://github.com/Th3Fanbus/SmolMachines
It's meant to be used with specific buildables implementing an interface to describe the "slots" they have on their faces, but it's possible to adapt for other purposes
Ah, found some videos: https://discord.com/channels/555424930502541343/623891487683510323/1225937030245126144 (I think the first video was just a reimplementation of the storage container hologram)
There are some helper functions in FGBuildableFactoryBuilding.h
This works great!