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 /
  • Help Room /
avatar image
0
Question by cherokeelakes94 · Dec 03, 2016 at 04:59 AM · animationnetworkingphotonmechanim

Help With Network Animations

I am using Photonview for networking in my FPS. There is an FPS controller with the standard scripts, which has a 3d model that the other players would see. I disable this for the current player, and enable it for all other players. The problem is the mechanim animator is opposite what it should be. When Player A moves, it can see the animation play on Player B. Player B can see the animations on Player A. I had a similar issue with movement and rotation, but this was solved by disabling the camera and character controller script, and then enabling them in the Start() function for each player. This made sure each player could only control themselves and not the other players. I have tried a similar method of disabling the player prefab's animator component, and then enabling it in the Start() function, but the same issue happens.

Here is the function that spawns the player and enables/disables each component(animator, character controller, camera, etc) accordingly,located in room_manager.cs:

     public void spawnPlayer()
 {
     GameObject pl = PhotonNetwork.Instantiate( playerPrefab.name, selectedSpawn.position, selectedSpawn.rotation, 0) as GameObject;
     pl.GetComponent<CharacterControls>().enabled = true;
     pl.GetComponent<CharacterControls>().fpsCam.SetActive(true);
     pl.GetComponent<CharacterAnimController>().enabled = true;
     pl.transform.GetChild(0).transform.GetChild(1).GetComponent<Renderer>().enabled = false;
 }

Here is the code for controlling the animator, located in animcontroller.cs:

     void Update() {
     animController.SetFloat("Horizontal", Input.GetAxis("Horizontal"));
     animController.SetFloat("Vertical", Input.GetAxis("Vertical"));
 }

The code to control the animator works correctly, other than it animates the wrong player. I am sure the problem lies in enabling/disabling each animator component like it was with the camera and controller, but I cannot figure it out.

The layout of my player prefab is as follows:

 PlayerA(has animator component with avatar set to avatar of body model, has script to update anim controller parameters based on player input)
         Body Model(What other players see, this is disabled for the current player, has a photon view component observing its transform)
         FPS Arms Object(the arms/gun the local player sees, is disabled for other players)
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

169 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

I'm not using mechanim, but my animation actually walks forward and then teleports back. Can I remove this? 0 Answers

Lerping to Smooth Network Movement 0 Answers

Photon RPC Only Working Halfway 1 Answer

How do I get photon to broadcast a signal to trigger an event? 0 Answers

Check what group id you have after being instantiated. (PUN) 1 Answer


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