third person shooter

I have a third person shooter on my game.
He moves properly,But he fires randomly.How to set him fire only on the center of the screen??

please let me know where should I insert or modify the code.I’m using java script.

Problem with TPS is that your center of the screen means aiming at a differebt spot for your charqcter depending on depth.

You could use a raycast to get the point where you are aiming and then make the charqcter aim at the spot

Sorry for the vague answer but that is all I can think of from the question.