# Applying ground tilt while rotating in place not working

Thanks for any help, greatly appreciated… = )

This short video shows the issue clearly:

The tanks in the video are rotating in place, and they are supposed to continuously match the terrain normal. There is code that gradually rotates them on the Y axis to point where they are supposed to turn towards, which you can see they do. After this, we are trying to apply the correct ground tilt using the terrain normal on the remaining x and z axes before finally setting the rotation for real. The LerpedMove in this code is the tank GameObject. For some reason, it appears that the ground tilt is simply not being applied at all. The tanks, as you can see, just rotate about the Y axis and completely ignore the attempt to apply tilt. This exact method of applying ground tilt is the same one we use when the tanks are just moving forward, and it works perfectly in that scenario. The tanks normally tilt to match the ground perfectly when they are moving forward along their spline paths, as you can see in the video, it just applies tilt on the x and z axes to match the terrain and looks fine.

//get ground tilt
if (Physics.Raycast(new Vector3(LerpedMove.position.x, LerpedMove.position.y + 50, LerpedMove.position.z), Vector3.down, out hit, 150f, Terrain))
{
curNormal = hit.normal;
}
grndTilt = Quaternion.FromToRotation(Vector3.up, curNormal);

//do some rotation on Y axis towards new end point
Quaternion newRotation = Quaternion.Lerp(prevRotation, nextRotation, (float)rotationProgress);

//modify the rotation to include the ground tilt, and set the final rotation
newRotation = Quaternion.Euler(-grndTilt.eulerAngles.x, newRotation.eulerAngles.y, -grndTilt.eulerAngles.z);
LerpedMove.rotation = newRotation;

The issue was that the nextRotation was rotating the tank about the world Y axis instead of the normal.