K.B.
I can't remember where I first heard/read the following suggestions, but it might be worth a try as a way to move toward pooping in the potty.
If you haven't let him see you (or someone in your family) go poop in the potty, it might be worth letting him do that. If he is afraid, it might make him less fearful if he knows everyone does it.
You could try letting him poop in a diaper/pull-up but in the bathroom. It sounds like he knows when he has to go because he hides in a corner. So maybe you can have him tell you when he has to go, bring him to the bathroom, and put him in a diaper. Give him a few minutes to go, alone if he so desires. At least then he starts to learn that he should be in the bathroom when he goes. Plus, it's an easier clean-up for you.
You could also show him that the poop goes in the toilet by flushing the poop from the diaper.
Once he is going to the bathroom in the diaper, you could have him sit on the potty with a diaper on. So he's still pooping in a diaper, which might be less scary, but he's getting used to sitting when he poops.
I've heard some people will split the diaper in the back/bottom once the kid gets the hang of sitting on the toilet with a diaper on so the poop drops through.
One of my sons is kind of in this stage. He is getting the hang of peeing in the potty but hasn't done any poops in the potty. Putting the diaper on in the bathroom worked the first time, but we knew he really had to go because it had been a while. But the next time he went in his pants.