Seriously, I'm 58 years old and need to pee a couple of times a night if I've had a fair bit to drink. The answer is a Nalgene bottle with a wide mouth. Roll onto your side, remove the lid, pop your todger into the bottle with the bottle at 45 deg and let it flow. When finished, immediately replace the nalgene lid. Either remove it from your sleeping bag or cuddle the bottle as it gets quite warm with fresh pee. If you think you may need again before morning, empty the bottle over the side in an area clear of kit.
On no account attempt to lean over the side of the hammock and pee that way. Eventually, one of these days you will suffer from roll back. That's where you are at a point of balance on the edge of the hammock, feel like you may fall out, overcompensate and roll back into the hammock onto your back. If you do that mid flow, it gets messy as hell.
A wide mouthed nalgene bottle is the answer.
Eric