how to Move Object in Real-time Multiplayer? ( Google Play Games plugin for unity)

自古美人都是妖i 提交于 2019-12-11 20:44:04

问题


i'm creating a realtime multiplayer game in unity. i'm using this plugin : https://github.com/playgameservices/play-games-plugin-for-unity

i need to move a ball in field(ground).

i can send and receive message between two player. but i don't know which information should i send and when to send. for example i'm sending myObject.transform.position;

can you give me some ideas about syncing the ball's move in field?


回答1:


You can try sending the target position instead. Then when you receive this target position, you can try to interpolate from the current position to the target position. This will make the movement more smooth and less dependent on the network. Similarly, if your ball is fully based on physics you have to send velocity and acceleration over. But every few frames or so, you need to check if the position is too far away from the other screen and you may need to snap it back. For even more complex and dynamically changing motions, you have to do some prediction.



来源:https://stackoverflow.com/questions/23395185/how-to-move-object-in-real-time-multiplayer-google-play-games-plugin-for-unit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!