Networking Physics Script.Please help!

I attached the script to my enemy and i still have the duplication problem.For some reason when another player connects to the game it loads the other player but you drive both cars.So if i have 2 windows open i drive 2 cars per window.Witch doesnt make sense.

Edit:I replaced the enemy prefab with the fps enemey prefab and i cant control both anymore.But instead of seeing a car i see a person.Maybe its my car scripts causing this.

Break through.Like my friend was saying only network physics if you know what your doing.Ok so i just went and removed the car script,and some other things from the enemy.Built it and now i can see the other player and im not having duplication issues.Only problem is the other player is simply my car moving around,wheels dont move or turn :(…Ok now how do i do that?Its obvious me using my car script to do this isnt going to work.

Is it best for me to animate the physics?Like when the other player turns i have the wheels animated to turn.And then do that?I know thats how the fps demo is.

I really hate to do this.Im creating a simulator and physics is the whole thing.Witch means players are gonna wanna see other player’s physics.

In addition to the car’s position and orientation, you also need to serialize the orientation of each of the car’s wheels (specifically, steer wheels).

What do you mean?

for example, lets say i have a four wheeled vehicle…my script would be something like:

internal struct State {
     internal Vector3 carPos;
     internal Quaternion carRot,
                                 wheelRot1,
                                 wheelRot2;
}

Transform carTransform;    
Rigidbody carRigidbody;    

Transform wheel1, wheel2;

State bufferedState;

void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info) {
	if (stream.isWriting)
	{
		Debug.Log("Sending Transform data to client");
		Vector3 pos = carRigidbody.position;                  //vehicle's position
		Quaternion rot = carRigidbody.rotation,               //vehicle's orientation
                                 wheelrot1 = steerWheel[0].rotation,   //left wheel's orientation
                                 wheelrot2 = steerWheel[1].rotation;   //right wheel's orientation

                //NOTE: this script assumes there are only two wheels that "turn" in response to steering 

		stream.Serialize(ref pos);
		stream.Serialize(ref rot);
                stream.Serialize(ref wheelrot1);
                stream.Serialize(ref wheelrot2);
	} 
        else {
                Vector3 pos = Vector3.zero;
                Quaternion rot = Quaternion.identity,
                                 wheelrot1 = Quaternion.identity,
                                 wheelrot2 = Quaternion.identity;

                 stream.Serialize(ref pos);
                 stream.Serialize(ref rot);
                 stream.Serialize(ref wheelrot1);
                 stream.Serialize(ref wheelrot2);

                 //state variables
                 bufferedState.carPos = pos;
                 bufferedState.carRot = rot;
                 bufferedState.wheelRot1 = wheelrot1;
                 bufferedState.wheelRot2 = wheelrot2;
        }       
}

//apply updates to transform(s)
void Update() {
        carTransform.position = bufferedState.carPos;
        carTransform.rotation = bufferedState.carRot;

        wheel1.rotation = bufferedState.wheelRot1;
        wheel2.rotation = bufferedState.wheelRot2;
}

You should be able to tailor this to include interpolation/extrapolation and/or account for any number of wheels. :wink:

Do not know if you mean by that, but if you have not been pre-scene, this usually means that you have not assigned the spawning script produces prefabricated houses. What error you get?