- Home /
SmoothFollow script issue for multiplayer car game
Hello, I've used the below code so as to make the camera follow my car function OnNetworkInstantiate(info : NetworkMessageInfo){
if(networkView.IsMine){ //if I am the owner of this prefab
Camera.main.GetComponent(SmoothFollow).target = transform;
}
}
This cam is following the server car, but at the client side the car is following the car but following in the angle that it is in, it doesnt change it's angle as per the car. Why is this so?
An answer is not deter$$anonymous$$able until you provide more information. Downvore
Unclear, but I'll wager a guess...
Say I have a clientA car and a clientB car and a server. ClientA is the owner of the networkview for carA and cameraA. And so B to B. The networkview is marked to sync the transforms of the cars and cameras.
Now clientA moves carA. SmoothFollow moves cameraA according to carA. But if I'm clientA, I need to not affect cameraB or carB. And so I need to disable the SmoothFollow on cameraB, or any cameras that aren't my camera (not the owner).
Depends on your setup, which cud be entirely different. But I thought I'd wager a guess...
Hope this helps!
Your answer
Follow this Question
Related Questions
Assign spawned object to SmoothFollow target 1 Answer
Unity networking tutorial? 6 Answers
Multiplayer camera switch issue 0 Answers
Multiplayer Client Missing Reference To Spawn Object 1 Answer