# Snapping mesh to surface

Hi, I am trying to get a mesh to cling to a surface like it is sticking to it.

I have an actor that consists of 2 meshes, the first one is held in the players hand and will be known as CM, the other one is a ghost mesh showing where the item will be placed which is known as GM. CM has a tracer that shoots out 500 units in front of it looking for a worldstatic object to hit, once hit the angles and position of GM is determined

GM is stuck to the surface and CM is held in a players hand in a VR game so can rotate freely, this causes problems to the angle on the incline.

This is what GM should look like when CM is pointed at an incline from any angle

but once CM starts rotating, GM starts doing this

here is the blueprint setup

The Z(Yaw) is recieved by CM which determines which way the mesh should be facing, thank you!
Skeletal Mesh and Static Mesh are CM, however only one is used based on the static boolean

Hi man,

Let me know if i get it right…
you are rotating the item in your hand, the ControlMesh (On the Right)
Than you cast a linetrace and detect where the GhostMesh will be shown, and you correctly get the location But the GhostMesh start rotating instead of following your movement.
As your hand move right and back leftward… you would that the ghostmesh moves the same.

My question is , how are you setting the rotation? are you adding a relative rotation? setting it ? the node itself is out of the screenshot.
Try breaking down the problem.
Set the GM to the same rotation of the CM, its stil rotating?

Hey! Thanks for responding!

The Control Mesh (CM) is the one on the left that is solid, the GM is the one on the right that is slightly see-through

When CM is rotating (like it spinning in a circle or moving in a players hand) it causes the GM to rotate forwards.

Setting GM to the same rotation as CM wouldn’t work because then it wouldn’t snap to the surface and would just be rotating freely

The rotation is set by combining the rotator that is made in the screenshot with the impact location into a transform and then setting the GM transform to the new transform

Edit:
The objective is to get the object to snap to the surface and stay at the same angles as it is at the beginning of the video regardless of CMs pitch and roll