Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void OnSerializeNetworkView ( BitStream stream , NetworkMessageInfo info ){
- if (stream.isWriting){
- //МЫ ОТСЫЛАЕМ ДАННЫЕ
- Vector3 pos = transform.position;
- stream.Serialize(ref pos); //"Encode" it, and send it
- }else{
- //МЫ ПРИНИМАЕМ ДАННЫЕ
- Vector3 posReceive = Vector3.zero;
- stream.Serialize(ref posReceive); //"Decode" it and receive it
- //We've just recieved the current servers position of this object in 'posReceive'.
- transform.position = posReceive;
- //To reduce laggy movement a bit you could comment the line above and use position lerping below instead:
- //transform.position = Vector3.Lerp(transform.position, posReceive, 0.9f); //"lerp" to the posReceive by 90%
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement