I'm trying to get the height of my ship above the ground (altitude if you like) at the moment I'v tried this
but I'm getting the distance to the center of the object (imagine a big flat plane for the ground) I'm after something like height above sea level, the distance from my ship to the ground plane
If you want just the height from the centre of your object to the ground plane (presumably this is what is stored in your var "Heighttarget"), you just need to compare the Y component of the position variables. Eg:
However if your object is of significant size, you might want the distance from the bottom of your object to the ground plane. In this case you can use Renderer.bounds to find the extremities of your object along each axis. In particular,
Here's an adaptation of your script:
And finally, if your ground isn't a flat plane (eg, hilly terrain), and you want the distance to the ground that's currently under your object rather than the distance to a fixed height (like sea-level), you'll need to use a Ray Cast (either Physics.Raycast or Collider.RayCast) each frame to determine the current height.