Raycast has an offset...

Paul

New member
Hi,

I've built the demo scenes that come with the PUN Multiplayer Add-On Asset. But I come to the conclusion that there is an offset in the Raycast (Hitscan) shoot system. In the screenshot you can see that there are 2 players in a room, 1 of which is shooting a bullseye and the location of the shot impact is different for both players.

I logged the firePoint and the fireDirection variables coming from the class ShootableWeapon function HitscanFire() (line 940). These don't always seem to match.

Hopefully, I am doing something wrong.. I haven't changed anything in the demo game.

Regards,
Paul
 

Attachments

  • Screenshot 2021-12-31 at 12.49.48.png
    Screenshot 2021-12-31 at 12.49.48.png
    520.6 KB · Views: 20
There is a spread on the ShootableWeapon which could be accounting for it. Also, if you draw a debug ray from the hitscan RPC event you should be able to determine the direction that is being sent compared to what is being fired on the other instance.
 
The spread is set to zero. The debug ray should help but the fact is or rather it looks like there is some weird offset present. Due to my setup or something else.
 
The problem is the "LookOffset" option that can be set in the CameraController (in the editor) on the MainCamera. I used the view type ThirdPersonCombat to test it. The "LookOffset" causes an offset whiling running a Multiplayer game.
 
When I tried it the decal was correctly spawned. It's hard to see because of the colors but in this image the crosshairs is pointing near the center of the target:

target.png


After I fired the decals appeared in the correct position on the client (selected to make it easier to see):

client.png
 
Top