Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Sending rotate data over the network.

Discussion in 'Connected Games' started by altair2020, Oct 28, 2012.

  1. altair2020

    altair2020

    Joined:
    Mar 6, 2011
    Posts:
    41
    Hi Everyone,

    I have just completed this tutorial series:

    http://codesynergy.wordpress.com/unity-networking-tutorial-in-c/#comment-101

    Now i think i have a slight understanding of networking... what i am struggling to do is send rotation information over the network. :confused:

    If I wanted to send the rotation details or if i wanted to send the entire Transform information of an object how would i do this?

    Also can you send constant force details?

    I am trying to make an Authoritative Server that accepts the position, rotation and constant force details of an object.

    If someone can kindly advise i would be obliged.

    Thanks,

    J.
     
    Last edited: Oct 28, 2012
  2. ColossalDuck

    ColossalDuck

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    Send the quaternion of the transform you want rotated over the network.
     
  3. altair2020

    altair2020

    Joined:
    Mar 6, 2011
    Posts:
    41
    Is this what i want to do ?


     
  4. ColossalDuck

    ColossalDuck

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    Close, what you did was send a Quaternion that has nothing to do with the transform, what you want to do is this:

    Code (csharp):
    1.  
    2. Quaternion rot = transform.rotation;
    3. stream.Serialize(ref rot);
    4.  
     
  5. altair2020

    altair2020

    Joined:
    Mar 6, 2011
    Posts:
    41
    Thanks Khopcraft this worked a treat !!!

    I also just fixed another problem where it was only updating on the server side.

    I realised that the Network View of the player object was set to "Off" I have changed this to "Unreliable" and the client and the server states are maintained.

    Thank you for your help !
     
unityunity