Hi. I’m trying to make a system to spawn a selected actor on the surface of the object that was just clicked using a line trace. The blueprint(s) for handling all of this is really messy and strewn about because I have code for other tools and systems there but the way I’m doing it currently is doing a line trace for objects from the camera, getting the hit location of the line trace, and spawning an actor at that location. Considering most of the actors I’m using have the center at the actual static mesh center, doing this would spawn it inside whatever i clicked on because the line trace is on the surface of the object. I added offsets that are specific vectors to enter in that it adds to the transform when the model is spawned to try and remedy this. This solves the problem when the model is being placed directly on the ground, but is messy and doesn’t solve the issue when the model is being placed on a wall or the ceiling of something.
My question is: How could I spawn an actor so that it is placed perfectly on the surface of the hit actor from the line trace, at the impact point?
Here’s a basic example of what I want to do in graphical form:
(Red = Line trace, Green = Spawned actor w/ mesh)
If you need additional info, feel free to ask, I only refrain from sending blueprint code screenshots because it’s quite a wild mess at the moment.