Updating transform in Update

Options
Hi All,

I have the following code:
void Update()
{
    if(hitBall)
    {
        myTransform.position = Vector3.Lerp(myTransform.position, ball.transform.position, 0.3f);
    }
}

Simple enough code, when the hitBall variable becomes active, lerp the player from their position to the ball position. This works fine locally, but once I connect to the server, the code doesn't work, I have placed Debug logs inside the code block and the code can be reached, it's just not executed.

I should note that my player is instantiated into the scene using the Photon Instantiate method, the ball has just been dropped into the scene in the editor, not sure if that makes a difference.

I'm only just testing this with the host at the moment, why is this not working, I must be missing something?

Thanks in advance.
Jason

Comments

  • Bassem
    Options
    maybe you are missing a photonView.
    Why don't you use RPC i think it's much better no?
  • JayFitz91
    Options
    Hi @Bassem

    Thanks for the reply, my objects have photonViews, I will be using RPC in the future so this information is transmitted to all clients, but right now, this does not even work for the host when there's only 1 player in the scene.

    Even without RPC, this code should work from the host side, but it's not working at all on the server, even though it works if I run the scene locally before connecting to the Photon servers.

    Any ideas?