Hey Devero - just so I understand your blueprint code correctly, it looks like you are determining a vector in which to align the decal. Given that decals project onto surfaces through their -ve X axis, I would suggest the best way to achieve the result you’re after is to find the surface normal of the point you want to align to, and get rotate onto that instead (to ensure that your decal is projected onto the surface correctly).
You should then be able to calculate a rotator for the local-space yaw that rotates the decal’s YZ plane into the correct direction.
I hope that makes sense? I’m happy to elaborate if needed - check out the surface snapping feature in the editor to see how we do this for placement of actors (which includes decals)
Thanks Andrew for the suggestion. Here is the pic of the changed decal projection, Blueprint. I actually tried this first but was unable figure out the Roll value.
So now the decal is projected perfectly onto any surface normal. However, Now I need to rotate the decal to match the direction of my white Arrow by inputting the “Roll” value to the decal. I’m still having issues figuring out the blueprint way to do it.
Hey - I had a shot at this myself - basically if you use the fact that the magnitude of the cross product of two vectors equals the sine of the angle between them { |a x b| = sin(theta) }, you should be able to transform your local-space direction vector into world space, cross this with some world space target vector and get the roll angle from that.
Here’s the Blueprint I came up with for this, hopefully it will put you on the right path:
Thanks for the continued help. I implemented your nodes and it gets just about there. The problem is when you take the arcsine the resultant only accounts for 0-90 degrees. Everything works great if I shoot ingame for only the 0-90 quadrant.
Maybe you could try composing a rotator from the angle axis of the cross product? The cross product will flip when it traverses a 180 degree boundary, so it should rotate correctly (provided your two vectors are on the same plane)
Thanks again for the suggestion. I was not able to get that idea to work out. However, I did work on more equations and came up with a solution that works great.