KAS.KASModuleAttachCore.MoveAbove C# (CSharp) Method

MoveAbove() public method

public MoveAbove ( Vector3 position, Vector3 normal, float distance ) : void
position Vector3
normal Vector3
distance float
return void
        public void MoveAbove(Vector3 position, Vector3 normal, float distance)
        {
            //Find position above the surface
            Vector3 hitAbove = position + (normal * distance);
            //Find the rotation aligned with the object surface
            Quaternion alignedRotation = Quaternion.FromToRotation(Vector3.up, normal);
            //Set position and rotation
            this.part.transform.position = hitAbove;
            this.part.transform.rotation = alignedRotation;
        }