ItemMoved Event question

edited August 2010 in Photon Server
Im receiving inside Unity the event ItemMoved, like this:
bd8001b7-e561-40ec-909e-1f2c4e4ec9fb: received event ItemMoved: OldPosition=float[28.35,60.32,2.29,] OperationCode=2 ItemId=131fd2d7-ae50-441b-8c9e-48c675b0a74b ItemType=0 Position=float[28.35,60.32,2.29,]
and Id like to know where in the server this event is sent, I suspect that where the server dispatches to the clients is at the MmoActor.cs function ItemOperationMove, is that correct?

The reason I ask this is because Im migrating the server to the newest version and right now I am adding the rotation parameter to the item movement. I believe I currently added the rotation parameter everywhere in the server but in unity it doesnt come in the event, Im sure Im forgetting something.

So what I have at the moment is that, im sending the rotation to the server no problem, I even have a log of the operation carrying the rotation value inside the move operation in the ItemOperationMove:
2010-08-28 18:29:07,601 [8] INFO  Photon.MmoDemo.Server.MmoActor - [ItemOperationMove] operation.Rotation[ 320,58,0 ]
that line comes from the variable:
Rotation = operation.Rotation
which is inside the function ItemOperationMove.

Here is the pastebin of my function:

So I was wondering that If I got the rotation from inside the Unity client up to here in the server, the next thing would be that the server would be sending it back to unity right? What could I be missing?

Let me know if you need to see more of my code, but basically the server is "brand new" this is the first thing I am changing since I unzipped it.


  • Boris
    Did you add the eventparameterattribute to the rotation property of the itemmoved class?
    You can check what's being sent by looking at the eventdata object you create.
  • zoultrex
    This is what I added at the end of the class ItemMoved.cs
    /// <summary>
    /// Gets or sets the rotation.
    /// This request parameter is mandatory.
    /// </summary>
    [RequestParameter(Code = (short)ParameterCode.Rotation)]
    public float[] Rotation { get; set; }

    When this wasnt there, the build would give an error about the variable that I was trying to send didnt have a definition in the class.

    In the DotNet class the file WorldEntered is logging null for the rotation variable in the event data:
    private static void HandleEventItemMoved(Game game, IDictionary eventData)
       var itemType = (byte)eventData[(byte)ParameterCode.ItemType];
       var itemId = (string)eventData[(byte)ParameterCode.ItemId];
       Item item;
       if (game.TryGetItem(itemType, itemId, out item))
          if (item.IsMine == false)
             var position = (float[])eventData[(byte)ParameterCode.Position];
             var oldPosition = (float[])eventData[(byte)ParameterCode.OldPosition];
             var rotation = (float[])eventData[(byte)ParameterCode.Rotation];
             if (rotation==null)
                game.DebugReturn("Receiving rotation NULL: ");
                game.DebugReturn("Receiving rotation: " + rotation);
             item.SetPositions(position, oldPosition, rotation);

    I guess the server receives the rotation from the client but it is just not broadcasting it back to the other clients.
  • Boris
    The event parameter should not have a requestparameter attribute.
    Compare the attribute above the rotation property to the other properties in the class.
  • zoultrex
    That was it! =)
    I copied that from the wrong place
    Thanks for the info.