How can I get the surface normal's rotation in collision?
EDIT: Answer posted.
I have a projectile that I have made stick to walls, currently behaving like the Medic's needles from TF2 (sticking to walls at any angle it hits).
I would like to change it so that it will be perpendicular to the surface, AKA aligning to the surface normal rotation. I'm not sure how to go about getting that kind of data using Blueprint.
I've tried searching a variety of keywords in the context-sensitive menu by dragging a wire from the outputs of the "OnComponentBeginOverlap" node, but I can't seem to find the data I'm looking for.
What would be a good way to go about doing this? Or doing something like applying a bullet hole decal after a ray trace? (which I assume also involves aligning to surface normal).
I've found the solution to calculating the angle of impact in blueprint, so I thought I'd come back here and post it for anybody who finds this question.
theta(angle between vectors a & b) = acos( dot(a,b) )
So here I use a Dot Product node, and input the forward vector from my projectile, and the impact normal of the hit result (from a trace or hit event). Then I take the Acos(degrees) node to output the angle in degrees.
Then (if the angle is valid) to rotate the projectile to match the surface normal rotation at the location of impact, I first move the projectile to the point of impact, then use the Find Look at Rotation node to rotate the projectile to face the wall.
To make it look like the projectile sticks, you will also have to disable any movement and physics.
Follow this question
Once you sign in you will be able to subscribe for any updates here