How do I shoot an instantiated object from a third person character to where my cursor(center of screen) is pointing?
Currently I'm making a third person shooter-like game where the main character shoots Instantiated objects (bullets) but the main problem is that I cannot get the bullet to fly in the direction of my mouse cursor(center of screen). I've tried achieving this in many ways and the closest was by shooting out a ray from camera through mouse position (mouse is always locked to the center of the screen), then taking the hitInfo.point RaycastHit variable and making a direction vector3 from my character to that point, so the bullets would fly straight to the hitInfo.point position. But, unfortunately, the bullets occasionally start to fly randomly around, even though I have placed walls with collision meshes all around so the ray would always hit something. The project is in C#. Thanks to anyone, who will help, in advance!!!!! I'm pretty new to game making, so trying to keep a positive attitude! Thank you!!
Your answer
Follow this Question
Related Questions
Shooting at mouse position with a slight camera rotation 0 Answers
LayerMask Not working when raycasting to Specific layer. 0 Answers
RayCast not accurate on non-colliders (3D) 1 Answer
Top Down Projectiles 1 Answer
How To Get Player Arms To Be On The Same Up Down Coordinate As The Crosshair 0 Answers