I want to test the client’s shoot event on the server.
Here’s what I’m doing at the moment:
-When firing, the client sends data to the server.
-The server receives them, simulates the situation exactly at the time that the client sent, sets the Raycast settings in the following way:
And then it checks for intersections, but the Raycast cannot find them, returns an empty array, although the direction, origin is correct.
Although there are intersections on the client. The only difference is that on the client I use the camera to set up the Raycast, and on the server I use the “set” method. The geometry is the same, here is the code for finding the intersection:
I tried to find an intersection using a camera by creating a camera on the server. So I simulate a client camera on the server using the Raycast method “setFromCamera”, there are intersections! However, it is always there wherever I look or where the client is … The problem is that the origin and direction of the Raycast.ray does not match the camera settings:
The problem boiled down to the fact that the Raycast is showing the wrong distance. I mean, my Mesh is far from Raycast, but Raycast thinks that Mesh is in the center of coordinates … Something very frivolous, but I cannot understand:
Here is the code:
Am I doing something wrong?