I have a client server scenario. On the Server a force is applied to a 2d object. I want the client to copy the movements of the server but not through constant positional updates. My current approach is to send the objects name, position and speed to the client for the client to apply those to its own object and therefore copy the server. The speed is calculated by subtracting the last known position from the current one and working out the magnitude:

physicsManagerScript.SendInfo (transform.name, transform.GetComponent<Rigidbody2D>().position, (transform.GetComponent<Rigidbody2D>().position-lastPos).magnitude);

The position and speed are received via RPC and each go into a list on the client and then the client object applies these via Vector3.MoveTowards:

transform.position = Vector3.MoveTowards (transform.position, receivedPos [index], receivedSpeed [index]/Time.deltaTime);

My problem is that even though the same magnitude is applied on the client as the server, the clients object moves very quickly in comparison to its server counterpart. The server object bounces around and eventually slows, however when it is moving slowly the client object flashes to its new position. I dont understand why this is happening when it should be moving at the same speed as the server object. Any help would be greatly appreciated.

**Additional Info

I have an invokerepeating method on the server that every second sends the name, position and magnitude to a physics manager script. This physics manager script then RPC's the client sending the correct position and magnitude to the correct name of object. The client object places the received position and magnitude into seperate lists. Vector3.MoveTowards is then used to move the client object to its new position at a new speed. However the speed it moves at is very quick in comparison to the server, when i want it to copy the server. This is for a distributed physics project, ie the server handles the physics and sends down the appropriate info without the client using any physics.

  • \$\begingroup\$ If the client doesn't have physics, how does it have a velocity? If the goal is to minimize the use of physics on the client, why not do frequent position updates? \$\endgroup\$
    – House
    Mar 16, 2016 at 18:12
  • \$\begingroup\$ @Byte56 I am comparing constant positional updates (high freqency data) against sending specific data such as go to this position at this speed (low frequency data) I want to compare and contrast the two across a network with varying conditions. Would you have any different suggestions with regards to what data to send? Or any ideas as to why I am having the above issue? Thanks for the reply :) \$\endgroup\$
    – CH99
    Mar 18, 2016 at 11:40

1 Answer 1


Doing some more research into finding out the speed a physics object is moving that I came across someone who found the magnitude of the velocity instead of finding the magnitude of the last known position from the current position. This changes my line to

physicsManagerScript.SendInfo (transform.name, transform.GetComponent<Rigidbody2D>().position, transform.GetComponent<Rigidbody2D> ().velocity.magnitude);

This seems to fix my issue!


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .