Car Collision Script with Photon

Goal: Multiplayer collision physics! I have been trying to get this working for hours and I tried everything I could think of. I would like a car to move in the direction that it was struck by another car.

The car is a prefab with a (non-kinematic)rigidbody, so both GameObject's that are colliding have rigidbodies! Everything is being called correctly but the final result of the AddForce is not working the way I had hoped or I'm not using the correct photon target when calling my rpc!

This is what I'm working with right now:
void OnCollisionEnter(Collision collision)
            Velocity = collision.relativeVelocity;
            NObjectHit =;
            photonView.RPC("CreateCollision", PhotonTargets.AllViaServer, Velocity, NObjectHit);
        public void CreateCollision(Vector3 velocity, string nobjecthit)
            Debug.Log(nobjecthit + "RPC");
            rigid = GameObject.Find(nobjecthit).GetComponent(typeof(Rigidbody)) as Rigidbody;
            if (rigid != null)
                rigid.AddForce(velocity * 1000);
                Debug.Log("Added Force");


Sign In or Register to comment.