Full mouse controls/moving with mouse

I’m having trouble with scripting a part of my game, I’m completely new to scripting games and only know the basic basics. I’m making an air hockey-type game but its 3d. I’m having trouble with connecting the character to my mouse while also having it stay flat on the surface of my table. I need help just getting the character to follow my mouse while staying flat on the table.

here’s my testing grounds im using right now to test other movement ideas: PlayCanvas | HTML5 Game Engine
If i could get some help i would be greatly appreciated