First off i do plan on going to a doctor and i did do a search but didn't find anything similar

The pain gets pretty bad at times only on extension it feels and seems like my knee cap is getting hung up and will not move "up" on extension. Ive been having this problem off and on for the last 7 or 8 months and does go away completely at times. It seems to appear and get worse when im not riding as much and usually i start riding more when it starts to hurt and i generally starts getting better(less pain). Also whats weird is it doesn't hurt any worse while riding or walking but sitting for any extended period is pretty much agony when its bothering me. If im sitting and try to extend it up i can only get to a certin point and it will not go any further untill i unload the weight and at that point i can watch my knee cap break free and move up then i can fully extend my knee. I was just wondering if anybody has experienced this and what to expect, it seems everytime im about to see a doc about it, it stops hurting and for some reason or another i just don't end up going.
EDIT: forgot to mention no prior knee injury, and when the knee cap moves up it makes a snap/crack sound, and im a pretty fit person 5'9" 145lbs