how to send animation information to server using appwarp unity3d sdk..

0 votes
i am using these fonction for the comunication with server

string json = "{\"x\":\""+gameObject.transform.position.x+"\",\"y\":\""+gameObject.transform.position.y+"\",\"z\":\""+gameObject.transform.position.z+"\"}";
            
listen.sendMsg(json);

public void onChatReceived (ChatEvent eventObj)
        {
            Log(eventObj.getSender() + " sended " + eventObj.getMessage());
            com.shephertz.app42.gaming.multiplayer.client.SimpleJSON.JSONNode msg =  com.shephertz.app42.gaming.multiplayer.client.SimpleJSON.JSON.Parse(eventObj.getMessage());
            
            //msg[0]
            if(eventObj.getSender() != appwarp.username)
            {
                appwarp.movePlayer(msg["x"].AsFloat,msg["y"].AsFloat,msg["z"].AsFloat);
                //Log(msg["x"].ToString()+" "+msg["y"].ToString()+" "+msg["z"].ToString());
            }
        }

 

public static void movePlayer(float x, float y, float z)
    {
        newPos = new Vector3(x,y,z);

    }

 

here i am sending movement information to the server. i am using unity animation techniques and character is animated but only in my device because animation info is not sended to server . but i also want to send animation information to server so that characher animate on both devices.

so what we have to do.
related to an answer for: how to animate the character in unity3d
asked Jun 5, 2014 in AppWarp by mahesh.kumar.sahu150 (10 points)

2 Answers

0 votes
Just compare the new postion with old position, if there is a change in postion, obviosly the player has moved, that you can show by running the character animation and and lerping the position to the new position.

You can study the AppWarp Unity Viking Demo http://blogs.shephertz.com/2013/09/27/multiplayer-unity-viking-demo-with-appwarp-2/
answered Jun 5, 2014 by Suyash Mohan (900 points)
character animation
0 votes

Hello Mahesh,

Similarly you can send the caharatcter animation of a gameobject to server as like you send movement of gameobject in json string.

You can use below given code if you got it, may me help you.

Public static Animator anim;

string json = "{\\"CharacterAnimation\\":\\""+appwarp.anim.GetBool("Name of Animation")+"\\"}";
WarpClient.GetInstance().SendChat(json);

and you will start receiving messages from it.

if (eventObj.getSender () !=  appwarp.username)

   appwarp.anim.SetBool ("Name of Animation",msg["CharacterAnimation"].AsBool);}

 

Thanks

Rampravesh Bhardwaj

 

answered Aug 3, 2016 by rbhardwaj1 (10 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...