I am working on a game that includes a feature that allows the player to place sticky notes on static meshes. My original method for finding the correct rotation was doing 6 line traces (1 for each direction) then rotating the sticky note accordingly.
This works fine but I want to know if it’s possible in visual scripting to find the rotation of a face in a static mesh based on where the line trace hit.
You can break the hit result and use the Normal pin to get the direction (not rotation) that your item should face. To set your item’s rotation to face that direction, you can calculate what rotation that unit vector represents and use the result.
This calculation can be done with multiple ways. One way would be using the dot product & acos method (though there’s an additional step there to include negative results) and another way would be using the Find Look at Rotation node. In both ways, we’ll compare the angle between our unit vector with the +x direction (x = 1, y = 0, z = 0) which is considered 0 degrees around z axis in world space.
This works but I still need the Sticky Note to be able to face up and down. This rotates it around the Z axis which is just 1 part of my solution. Can I have help solving the issue of it facing up and down ?