Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Zeradias · Jan 27, 2017 at 07:50 PM · animationnetworkingnetworkonlinerpg-game

Online Rpg Animation does not work

Hello, I have a game that I would like to make online, in the current step I am testing the movement of two players in Match Maker, one in unity and another in an android. When I connect the two, I can move and see the movement of the two players, but the player can not see animation of the other player, only yours. (Knowing that it needs a transition in the animator to perform) Follow the drive code, and images of each device at the same time. Thanks any help or tip.

using UnityEngine; using System.Collections; using UnityStandardAssets.CrossPlatformInput; using UnityEngine.Networking;

public class MoveJoystick : NetworkBehaviour {

 public float moveSpeed = 5;

 private bool playerMoving;
 private Vector2 lastMove;
 private Animator anim;

 private Rigidbody2D myBody;

 private float velocityX;
 private float velocityY;

 void Start ()
 {
     anim = GetComponent<Animator>();
     myBody = GetComponent<Rigidbody2D>();
 }
     
 void Update ()
 {
     if (!isLocalPlayer) {
         return;
     }

     Walking();

 }
     
 void Walking(){
         playerMoving = false;


         if(CrossPlatformInputManager.GetAxisRaw("Horizontal")>0.4f || CrossPlatformInputManager.GetAxisRaw("Horizontal")<-0.4f)
         {
             velocityX = CrossPlatformInputManager.GetAxisRaw("Horizontal") * moveSpeed;
             // transform.Translate(new Vector3(CrossPlatformInputManager.GetAxis("Horizontal"), 0f, 0f) * moveSpeed * speedModificator);
             playerMoving = true;
             lastMove = new Vector2(CrossPlatformInputManager.GetAxisRaw("Horizontal"), 0f);
         }

         if (CrossPlatformInputManager.GetAxisRaw("Vertical") > 0.4f || CrossPlatformInputManager.GetAxisRaw("Vertical") < -0.4f)
         {
             velocityY = CrossPlatformInputManager.GetAxisRaw("Vertical") * moveSpeed;
             // transform.Translate(new Vector3(0f, CrossPlatformInputManager.GetAxis("Vertical"), 0f) * moveSpeed * speedModificator);
             playerMoving = true;
             lastMove = new Vector2(0f,CrossPlatformInputManager.GetAxisRaw("Vertical"));
         }

         myBody.velocity = new Vector2(velocityX, velocityY);

         if (CrossPlatformInputManager.GetAxisRaw("Horizontal") < 0.4f && CrossPlatformInputManager.GetAxisRaw("Horizontal") > -0.4f)
         {
             myBody.velocity = new Vector2(0f, myBody.velocity.y);
         }

         if (CrossPlatformInputManager.GetAxisRaw("Vertical") < 0.4f && CrossPlatformInputManager.GetAxisRaw("Vertical") > -0.4f)
         {
             myBody.velocity = new Vector2(myBody.velocity.x, 0f);
         }

         if (HurtEnemy.isAtk == true) {
             lastMove = PlayerTurn.lastMovem;
         }


         anim.SetFloat("MoveX", CrossPlatformInputManager.GetAxisRaw("Horizontal"));
         anim.SetFloat("MoveY", CrossPlatformInputManager.GetAxisRaw("Vertical"));
         anim.SetBool("PlayerMoving", playerMoving);
         anim.SetFloat("LastMoveX", lastMove.x);
         anim.SetFloat("LastMoveY", lastMove.y);
     }

}alt text alt text

anim1.png (162.5 kB)
anim2.jpg (234.0 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How can I create a simple chat system for my multiplayer game? 1 Answer

Photon variable synchronization 1 Answer

Going from LAN to WAN (UNet Online) 2 Answers

Unity Photon Virtual Joystick Problem HELP???? 1 Answer

Network Animator set trigger not working 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges