Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Third Party [PHOTON] AddForce to Bullet in Network

Discussion in 'Multiplayer' started by marf, Dec 28, 2011.

  1. marf

    marf

    Joined:
    Jul 20, 2011
    Posts:
    124
    Hi, I have a problem with the AddForce method:

    When a player fire I istantiate an object called proiettile withi this code:

    Code (csharp):
    1. proiettile = PhotonNetwork.Instantiate(proiettilePrefab, muzzleFlash.transform.position, muzzleFlash.transform.rotation, 0) as GameObject;
    Then I add force to it:

    Code (csharp):
    1. proiettile.rigidbody.AddForce(-transform.forward * 10000);
    In the local player (the one that fire) bullets have force, but the other player sees only the istantiated bullets with no force that fall on the ground.

    I added a PhotonView to the bullet prefab that observe the rigidbody of the bullet, but nothing happens.


    Regards,

    Marco