It's possible to AddForceAt(); on the PhotonNetwork?

I'm Current making my game, FPS, but, i'm trying to make something like this:
I Have a Crate with RigidBody, and PhotonView, if I Shot this Crate, it AddForceAt:
hitTransform.GetComponent<Rigidbody>().AddForceAtPosition(700 * transform.forward, hitPoint);

But, the Master Client can Do this, if i'm the master and shot this crate, it add force, But... if i'm not the master, and shot the crate, it goes down by rigidbody, but it return to the original place, It's possible to make something like: anyone can addforce to this crate?
Thx for the Attention :p.

(Sorry for my Bad English, i'm Portuguese '-' ).

Comments

  • My god... anyone can help me? plz plz
  • If client is not master, it should not add force directly but rather send 'addForce' RPC to master telling master apply force.
    Only changes to position made by owner (master in your case) are broadcasted to other clients and eventually applied to object instances no matter how non-owners change object position.
  • My Script is not working, plz help me, the RPC and the call of the RPC is it:
    &#91;RPC&#93;
    	public void AddForceAt(Transform ht, Vector3 hp)
    	{
    		ht.GetComponent&lt;Rigidbody&gt;().AddForceAtPosition(700 * transform.forward, hp);
    	}
    

    and
    if(hitTransform.GetComponent&lt;Rigidbody&gt;() != null && hitTransform.tag==("Physics"))
    	{
    	GetComponent&lt;PhotonView&gt;().RPC("AddForceAt", PhotonTargets.MasterClient, hitTransform, hitPoint);
    	}
    

    *hitTransform is the Object that i Shooted, and the object I Want to addForce*
  • Why do you send transform in RPC? It can't be sent over network. Send force Vector3 insread.
  • Can you help me with the RPC? like the parameters or the code i need?? i don't understand this part, if you can help :p
  • You can find lot of RPC usage samples in PUN demos.

    Transform passed as parameter in RPC should cause an error and inability to send RPC since PUN does not know how to send Transform.
    Make parameter type Vector3 instead of Transform and pass 700 * transform.forward to it.