ExitGames-Photon-MMO-Demo_v2-0-5 Items below terrain

Options
ktweedy1
ktweedy1 ✭✭
edited August 2010 in DotNet
I am running the Photon.MmoDemo.Client.Unity3D and I see all the items, but they are under the terrain. Been trying to learn enough to see why this is happening.

I have the terrain and I am able to move around on it without falling through so I don't think they are falling through. If i go into scene view and move them, they pop back to their location under the terrain.

I am able to run the WinGrid and start lots of items.

Any suggestions on why this is or where I can look into how the position of the items if done.

Thanks.

Comments

  • Boris
    Options
    interesting. The new mmo demo passes the received float positions 1:1 to the other clients, before there were only 2 digits after the comma synchronized.
    So it might be that the offset used for the item height is now different..
    The code is in Actor.cs in the unity client.
    Going to check this later today. Thanks for the info.
  • Boris
    Options
    mh - everything looks fine here
  • ktweedy1
    Options
    I found this out, my terrainHieght is never getting calculated. I comment out the pos.Length == 2 check and force it to calculate height and it works.

    /// <summary>
    /// The get position.
    /// </summary>
    /// <param name="pos">
    /// The pos.
    /// </param>
    /// <returns>
    /// a vector 3
    /// </returns>
    private Vector3 GetPosition(float[] pos)
    {
    float x = pos[0] / MmoEngine.PositionFactorHorizonal;
    float y = pos[1] / MmoEngine.PositionFactorVertical;
    // if (pos.Length == 2)
    // {
    float terrainHeight = Terrain.activeTerrain.SampleHeight(new Vector3(x, 0, y));
    return new Vector3(x, terrainHeight + 2f, y);
    // }

    // return new Vector3(x, pos[2] - this.camHeight + 4f, y);
    }
  • Boris
    Options
    strange, this means your player submits the wrong height - see Player.Move and GetPosition
  • Boris
    Options
    the problem with calculating the height is that you can't sync neither jumps nor walks over the bridge
  • Boris
    Options
    are you running the new mmo demo against the old 2.0.4 server by any chance?
    that would submit a height of 0 from the grid world.
  • ktweedy1
    Options
    Hi,

    Yeah, I think I am running the server from the ExitGames-Photon-Server-SDK_v2-0-4 zip.

    Currently doing the add rotation tutorial, once it get it to compile will switch to using the server in the MMO zip and see how it works.
  • ktweedy1
    Options
    Probably the if statement should say if y < terrainHeight then caculate height. but just learning, i could be wrong.
  • Boris
    Options
    ktweedy1 wrote:
    Hi,

    Yeah, I think I am running the server from the ExitGames-Photon-Server-SDK_v2-0-4 zip.

    Currently doing the add rotation tutorial, once it get it to compile will switch to using the server in the MMO zip and see how it works.
    ok, then it's clear why this is happening.. the old version converted 2D positions into 3D positions and the mmo island client compared the last position field to 0:
    if (pos&#91;2&#93; == 0)
     {
    float terrainHeight = Terrain.activeTerrain.SampleHeight(new Vector3(x, 0, y));
    return new Vector3(x, terrainHeight + 2f, y);
     }
    
    the new version routes the exact coordinates that were received, so now the array has just 2 fields when sending 2D coordinates.