- Home /
NetworkView, Mouselook and syncing
Hello
I have an issue with synchronizing the Y-axis on the weapon in an FPS im working on.
What happens when i try to synchronize the position of the weapon is that half of the frames you will see the gun in its intended position, but when you stop moving the gun, the position gets reset to its original position.
My gameobject Hiearchy is set up like this:
root(the base mesh, the character)
|-Camera with a mouselook
|-Gameobject with a mouselook
|-My gun
I have a networkview on the gameobject and the Root, to synchronize the movement, but with this setup i get the bug i described above. I have tried the same setup, with a slight change:
root(the base mesh, the character)
|-Camera with a mouselook
|-Gameobject without a mouselook, still with the network view though
|-My gun
what i did in this setup was to attack a script to the camera with these lines of code in it:
public GameObject objects;
void Update () {
objects.transform.rotation = transform.rotation;
}
the issue i got with this method was some extremely choppy movement and lag between the gun and the Camera. the position of the Gun did get synchronized without any issues though.
Lastly i tried to have the gun as a child to the camera, which didnt work because all cameras but your own is disabled, which means that the rotation of the camera isnt synchronized.
So please help me out here, im more or less at my wits end, only thing i havnt tried yet, which i know of, is black magic.
Thanks in Advance
-Kacer
Answer by roamcel · Aug 22, 2011 at 02:10 PM
I don't fully understand your setup however I have three suggestions:
1- increase tickrate
2- use LateUpdate
3- implement interpolation
Approaches:
1- edit=> project settings=> network. increase the value to 25 and verify if situation changes
2- if you have an animation running and your weapon is part of that animation, whenever you change the transform you need do it in the lateupdate, otherwise the transform gets overwritten
3- this is tricky. exclude the other two first.
I have already implemented interpolation and lateupdate, could you please explain me what Tickrate is all about?
'tickrate' is just a way to tell about the rate at which network packets are sent.
open your project and access the edit menu, and from there, project settings=> network increase the 'Sendrate' value. This is basically the number of times a second that your networkViews will synchronize their observed object over the network.
Tick-rate is basically the fps of your network packets. Low values cause stuttering, and high values increase network overhead.
Your answer
Follow this Question
Related Questions
Mouselook.js don't move smooth, its jittery 4 Answers
reset camera position mouselook 1 Answer
Mouse look script help 1 Answer
Mouselook forward wrong? ... 1 Answer
Mouselook rotate around two axis. 0 Answers