Feed LineTrace random spread into SpawnActor spawn transform?
I have a blueprint with firing logic, where I'm using both a LineTraceByChannel node for hit detection and a SpawnActor node for bullet trail visuals.
I've managed to get the LineTraceByChannel to have a random spread.
How do I use the same LineTrace random spread to influence the SpawnActor Spawn Transform? How can I get their paths to line up?
You want to know the location of where the trail will start from and end at (I'm assuming this is a gun since we are talking about bullet trails), that would be the location where your trail starts and spawns. So for the location of the transform you either keep it the same if it's the correct start location or you put your gun muzzle as a location (if you don't have a way of getting the gun muzzle location you can just attach a socket or if it's not a skeletal mesh some invisible object).
For the rotation you want to calculate the direction, there's already a node that does that for you called "Find look at rotation", for the start you use the same location that you plugged into the transform and for the target you use the trace hit/end location (you could either set the random spread to a vector variable before spawning the trail and use that variable for both the transform of the trail and the trace end location or move the trail after the trace and get the exact hit or end location by breaking the Out Hit of the trace). If your trail is done properly that should rotate it to the correct direction.
answered Jul 13 '18 at 02:37 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here