I dont know much about how a projectile is set but line trace gives you the hit surface normal information when you break hit result so you may want to look into that.
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).
Hm, if returning surface normal info is unique the line trace, I may just have to do a short line trace after my overlap event fires. Thanks for the tip, I’ll look into that.
I found what I was looking for. I should have been using the OnHit event instead of the OnBeginOverlap event. OnHit returns hit info with normals and impact etc.
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.
What I did to get my hit result was to trace a line every frame from my projectile’s location, towards its forward vector a short distance until it hit something.
Thanks for posting your solution!
Thank you very much for posting the solution !!!
even after a year and a half that so helped !!!
Thanks again !
No problem! I’m very happy to help.