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! Your search result can be found below. Plus, we offer support via these channels:

Try Our

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.

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.

What is the proper way to AddForce in Fusion?

2022-07-19 11:02:46

I'm building a game where player characters are controlled via Unity physics engine, each player has a NetworkRigidbody and player input is used to determine forces being applied to that rigidbody. I'm not certain what the proper approach here is for Fusion, since all examples I can find just set velocities or positions in FixedUpdateNetwork, but Unity wants you to use FixedUpdate for things like AddForce. Anyway, here's a pseudo code version of what I'm doing right now:

NetworkedRigidbody rb;

Vector3 movementInput;

Vector3 movement;


InputData input = GetInputViaNetworkedObjectDotGetInput();

movementInput = input.movement;


private void FixedUpdate() {

movement = UpdateMovementOverTime(movement, movementInput, Time.FixedDeltaTime);

rb.RigidBody.AddForce(movement, ForceMode.Force);


Anyway, what would this pseudo code look like in the proper Fusion approach? Should some of the variables be [Networked]? In particular "movement" would be subject to time-dependent evolution


2022-07-29 15:14:55

I found an official Photon engine example, it seems they just go ahead and put regular AddForce calls in FixedUpdateNetwork. I'm not sure how that works with the time scale, since the deltatime can be 0, but it does seem to work fine as long as I'm careful with dividing by deltatime in my code.

Time varying variables like the movement vector in my example should definitely be networked, altough my use case is a bit more complex so I will have to work something out...

Back to top