Unity 2d shooting porjectiles from mouse input.

Hello everyone,
got a quick question didn’t find it in the forums but need some direction. I am shooting a project in the z direction in a 2d game and I have been trying to use Camera.ScreenWorldToPoint(), ScreenToViewPoint(), but every time I shoot the projectile it goes the centerpoint of the camera and never renders at the point of the mouse click, if that makes sense. So any help with this would be appreciated.

Can you show the code you have now? That will make it easier to help you out :wink:

if (Input.GetMouseButtonDown(0))
         {
        
			var ray = cam.ScreenToWorldPoint(mousePos);
			
			clone = Instantiate(projectile,ray, Quaternion.identity) as Rigidbody;
			clone.velocity = new Vector3(0, 0, 250);
         }

This is what I am using.

So what I am trying to do is make a 2d game and when I press the mouse or touch the screen the missile fires from the spot that was touched, any ideas on this one?

So no one, I know people get busy but please don’t ask to see code unless you could help someone out, that is why people don’t post code because it seems those who ask to help just want code.

Thanks for your reply and thanks for trying.