Raycasts not working in multi-peer mode

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on Fusion.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Raycasts not working in multi-peer mode

RefraX295
2022-10-30 10:36:07

Hi,

I am unable to get raycasts to return any hits when using multi-peer mode in photon fusion. I have no issues when using single-peer mode. Am I missing something?

The raycasts are needed for clientside logic and I have tried calling the raycasts from Update, FixedUpdate, Render and FixedUpdateNetwork without luck. I have also tried the LagCompensation.Raycast functions with the same issues.

Edit: Turns out I just had to use the Runner.GetPhysicsScene() to do the raycasts, since each peer gets their own physics scene.

Comments

Isaac_Augusto
2022-10-31 12:41:56

Hi,

Yes, in multi-peer you need to use Runner.GetPhysicsScene() to refer the correct physics scene.


Isaac Augusto

Photon Fusion Team

Back to top