- Home /
Question by
Pritamde12 · May 09, 2014 at 05:08 AM ·
androidmultiplayer
How to send transform.position and transform.rotation values to Google multiplayer server?
This is for a multilayer game where i need to send the postion and rotation values for the server and get it back from there again.Google only allows sending through bytes. This is what i am trying.
float aa;
float bb;
float cc;
byte[] xx =new byte[5];
byte[] yy =new byte[5];
byte[] zz =new byte[5];
void Update() {
aa=transform.postion.x;
bb=transform.postion.y;
cc = transform.postion.z;
xx = System.BitConverter.GetBytes (aa);
yy = System.BitConverter.GetBytes(bb);
zz = System.BitConverter.GetBytes(cc);
PlayGamesPlatform.Instance.RealTime..SendMessageToAll(false,xx);
PlayGamesPlatform.Instance.RealTime..SendMessageToAll(false,xx);
PlayGamesPlatform.Instance.RealTime.SendMessageToAll(false,zz);
}
Now i don't know how to check what data i am receiving. Generally, accrording to Googles examples its done like this:
byte[] temp = new byte[1];
temp=(byte)'R';
public void OnRealTimeMessageReceived(bool isReliable, string senderId, byte[] data) {
if(data[0]==(byte)'R' )
{
float xyz = data[0];
}
}
But in this case i don't have a character at the start of the byte array. How to send Quaternion values beats me. Thanks in advance.
Comment
Your answer
Follow this Question
Related Questions
Photon - RPC Does Trigger but Does not Show Over Network :( 0 Answers
Multiplayer Networking Problem in Android 0 Answers
Multiplayer Tutorial android problem 0 Answers
NAT Punchthrough problems on Android. 0 Answers
Cross-Platform Multiplayer 2 Answers