Top Down Shooter [DEMO]

I think it’s rather questionable where the bullet direction seems to be calculated. It is offset by some strange angle, which changes depending on the direction you are looking at.

This is confirmed when you use a laser.

https://i.gyazo.com/bab6c9198d6b7cce0c25d3b05930cf35.mp4

Notice that my mouse is on the player, so is the laser, but the bullets are in a slightly different direction than the laser, making the laser rather useless in this sense.

It is actually the laser that points exactly to mouse hit position. If you see carefully you will see that the bullets are actually being fired exactly to the direction where the gun is aiming.

Perhaps, but this doesn’t map very well with your camera angle from the player’s perspective.

From a gameplay standpoint, it would seem more intuitive to me to see the bullets land directly in the position the mouse points on. Perhaps it is up to your own judgement to keep it the way it is.

Either way, the laser being off from the bullet’s path makes it for a rather noticeable inconsistency.

Just do it on the server and give the ownership to the player

The problem is that the camera is at an angle while the mouse.hit is hitting the ground. Just setting the actual shooting point to the gun’s Y isn’t the correct solution. I’ll draw a diagram to show why your current solution isn’t working.diagram.png

As you can see, the current solution makes it feel as if the gun is aiming slightly offset to where you are. A good solution would be to just raycast towards the mouse.Hit with a length that is whatever the hypotenuse is in the diagram less than the distance between the camera and mouse.Hit.

(If you don’t know trig or don’t want to do the math though, you could also just put an invisible part at the mouse.Hit + 4Y or whatever and make it large enough so that your mouse.Hit would intersect with it, and use that position.

Would have to raycast and ignore the invis part, in order to get the correct position of where the mouse.Hit would be if there wasn’t an invis part to correctly place the invis part though.)

Yeah but it is impossible to do something like this. My mechanic is different. I just wanted to be able to shoot forward you that can reach big distances without having to aim there exactly with the mouse pointer, i don’t know how else to explain it. There is one solution for this however. If i change the MOUSE’s cursor icon to be a little bit offset from the original center point of the mouse, then it will shoot exactly where i am aiming. I am saying this because i tried your method and did not quite work

Ok, sorry, nevermind :smiley: It actually worked. I was doing something wrong before and it didn’t work as it had to :smiley:

And here it is:

https://gyazo.com/20b1b198ec5d4892e9b4841a619a27cb

Thank you so much for help! ^^

Yup! Glad it worked man ^.^