HTML5¼¼Êõ

½áºÏWebSocket±àдWebGL×ۺϳ¡¾°Ê¾Àý - ljzc002(12)

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2016-11-07 12:00 ÎÒÒªÆÀÂÛ( )

{ 3 var obj = arr_webplayers[key2]; 4 switch (obj.methodofmove) 5 { 6 case "controlwitha" : 7 { 8 obj.lab.rotation.y=(-1.55 - cameraArcRotative[0].alpha)- obj.mesh.rotation.y; 9 if (obj.countstop=4 )

{ 3 var obj = arr_webplayers[key2]; 4 switch(obj.methodofmove) 5 { 6 case "controlwitha": 7 { 8 obj.lab.rotation.y=(-1.55 - cameraArcRotative[0].alpha)-obj.mesh.rotation.y; 9 if(obj.countstop<=4) 10 { 11 if ((obj.vmove.x != 0 || obj.vmove.y != 0 || obj.vmove.z != 0 || obj.rychange != 0)&& obj.PlayAnnimation == false) { 12 obj.PlayAnnimation = true; 13 obj.beginSP(0); 14 obj.mesh.moveWithCollisions(obj.vmove); 15 } (obj.vmove.x == 0 && obj.vmove.y == 0 && obj.vmove.z == 0 && obj.rychange == 0 && obj.PlayAnnimation == true) { 17 obj.countstop++; { 20 obj.PlayAnnimation = false; 21 obj.stopSP(0); 22 } 23 } 24 } 25 break; 26 } 27 default : 28 { 29 break; 30 } 31 } 32 }

 c¡¢×îºóÊǶÔNPCÎïÌåÔ˶¯Í¬²½µÄ´¦Àí£º

1 case "[admins]": 2 { 3 if(username=="admin") } { 9 if(!scene.isReady() || !arr_myplayers) 10 { 11 return; 12 } 13 var arr_rabbitmove=JSON.parse(str_data.substr(8)); 14 var len=arr_rabbitmove.length; 15 for(var i=0;i<len;i++) 16 { 17 var arr=arr_rabbitmove[i]; 18 var rabbit=arr_animals[arr[0]]; 19 var rabbitmesh=rabbit.mesh; 20 rabbitmesh.position=arr[1]; 21 rabbitmesh.rotation=arr[2]; 22 rabbit.vmove=arr[3]; 23 rabbit.rychange=arr[4]; (arr[5]=="run"&&rabbit.state=="eat") 26 { 27 rabbit.state="run"; 28 rabbit.powerofmove=3; 29 scene.beginAnimation(rabbitmesh.skeleton, 0, 72, true, 2.4); 30 } (arr[5]=="eat"&&rabbit.state=="run") 32 { 33 rabbit.state="eat"; 34 rabbit.powerofmove=1; 35 scene.beginAnimation(rabbitmesh.skeleton, 0, 72, true, 0.8); 36 } 37 } 38 } 39 break; 40 }

½â¿ªJSON£¬¶Ôÿһ¸öNPCÎïÌå·Ö±ð´¦Àí¡£

Îå¡¢²¿ÊðºÍʹÓãº

³ÌÐòÍêÕû´úÂëÔÚ¿ÉÒÔÔÚhttps://github.com/ljzc002/WebGL2ÏÂÔØ£¬ÎÒ±àдµÄ´úÂë»ùÓÚMITЭÒé·¢²¼£¬Ê¹ÓõĵÚÈý·½¿âÎļþ°´ÆäÔ­Óеķ¢²¼Ð­Òé·¢²¼¡£

²¿Ê𣺰ÑPRACTICE/WebRoot/ϵÄËùÓÐÎļþ¸´ÖƵ½PRACTICE3/Ŀ¼Ï£¬½«PRACTICE3/¸´ÖƵ½TomcatµÄWebApps/Ŀ¼Ï£¬°ÑPRACTICE3/¸ÄÃûΪPRACTICE/£¬Æô¶¯Tomcat£¬·ÃÎÊscene_link.htmlÒ³Ãæ¡£

ʹÓ㺵ÚÒ»¸öinputÊäÈëWebsocketËùÔÚIP£¬µÚ¶þ¸öinputÊäÈëÓû§Ãû£¨ÊäÈëadmin±íʾÉêÇë×÷ΪÖ÷»ú£©£¬µã»÷¡°websocketÁ¬½Ó¡±½¨Á¢Á¬½Ó£¬µã»÷¡°Æô¶¯³¡¾°¡±Æô¶¯WebGL³¡¾°¡£

Áù¡¢Ð´ÔÚºóÃæµÄ»°£º

ÏÞÓÚʱ¼äºÍ±à³Ìˮƽ£¬³ÌÐòÖл¹ÓкܶàbugºÍȱÏÝ£¬»¶Ó­´ó¼ÒÅúÆÀÖ¸Õý¡£

¡¡

1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

Ïà¹ØÎÄÕÂ
  • HTML5 WebSocket - Roberter

    HTML5 WebSocket - Roberter

    2016-10-25 16:00

  • websocket³õ̽ - 2778085001

    websocket³õ̽ - 2778085001

    2016-07-16 15:11

  • DIV+CSS:ÈçºÎ±àд´úÂë²ÅÄܸüÓÐЧÂÊ - 2778085001

    DIV+CSS:ÈçºÎ±àд´úÂë²ÅÄܸüÓÐЧÂÊ - 2778085001

    2016-06-29 15:00

  • ÓÃnodeʵÏÖwebsocketЭÒé - 2778085001

    ÓÃnodeʵÏÖwebsocketЭÒé - 2778085001

    2016-06-25 14:00

ÍøÓѵãÆÀ
Õ