I’m trying to make an FPS and obviously I want the ability to shoot meshes.
The meshes that will be shot are going to be picked by the scene.pick(screen.width/2, screen.height/2) method. The thing is that by doing so I can actually shoot(and remove from the scene) only the nearest skull from the three that are shown in the supplied screenshot.
I also tried using a custom ray and setting its length to a huge number but still I get the same results and that drives me crazy cause I thought that when I implement a rifle into the game I would do it by using a custom ray for it since it can see at a longer range than a pistol…but that even doesn’t work.
What am I missing here ?
[FINAL EDIT-ANSWERED] I used the ticked solution, plain and simple. Also the bug I had was because of the my css-crosshair being positioned at the center of the screen using its top left corner as the origin so you had to aim slightly to the left to get the correct aiming that is according to the ray we created.
Also another funny thing was that when I shoot a skull in the distance the other distanced one would disappear too. After banging my head I found out it was cause they were named the same so
would delete both of them.
Not actually related to my original post but maybe someone will find it and take some hints on how shooting is supposed to work. Thanks to @Givo . Check his playground link too !