Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Kacheek · May 30, 2013 at 06:56 PM · animationmultiplayermultiplayer-networkingrpcanimating

Animation Update for the TPS controller

Hello there,

Well i am trying to program a small social multiplayer game with only a few functions such as running around,chatting, an inventory with clothes and well the clothes!

so far im done with the chat, names being displayed over the players head and the position updates across the network putting the more complex stuff with the clothes aside my current question is

how can i play animations over a network?

for the position update i just used RPCs but everytime im trying to use those for my animations it says that there is no object attached and it has to be one attached...

im using the standard tps controller provided by unity with that builder guy with a unity symbol on his stomach and the yellow helmet.

my attempt was to acces what current characterstate of the controller script is, define a number for every state and then send it to the network with an RPC call i used a float variable for that

than i wanted to write a script that takes that number and based on the number which came in it plays a specific animation

all i actually succesed with a script that gets the state of the charactercontroller defined as a number (float) but i cant get it sent as an RPC because it always says there is no object attached... but i have attached the script to an object! to the player! same with the animation it says no object attached...

well i know that the tps controller actually also does cross fading and changes the animation speed based on how fast the character is but i would be happy if i would at least see other player run instead of flyign around...

well i hope you guys could help me out !

thanks in advance!!

best regards

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Kacheek · Jun 06, 2013 at 06:02 AM

well i pretty much found kind of a solution instead of sending the other players what animation one player is currentle using ive mad every client to figure out which animation to play by checking the speed other character have for example if they move slower than 0.1 a sec they idle if its under 1 a sec (or so) they walk if its faster they run just jumping doesnt work yet...

heres the code for it! just type it in the standard character controller

 function Awake () {
 if (networkView.isMine == false) {
 InvokeRepeating("animationUpdate", 1, 0.3f);
 }
 }
 
 
 
 function animationUpdate ()
 {
 if(Vector3.Distance(myTransform.position, lastPosition) >= 1.2)
     {
 lastPosition = myTransform.position;
 _animation.CrossFade(runAnimation.name);            
     }
 
         else
         {
         if(Vector3.Distance(myTransform.position, lastPosition) >= 0.15 && Vector3.Distance(myTransform.position, lastPosition) < 1.2)
     {
 lastPosition = myTransform.position;                                                                                      _animation.CrossFade(walkAnimation.name);    
     }
 
         else
         {
                    _animation.CrossFade(idleAnimation.name);
         }
     }
 }
 
Comment
Add comment · Share
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

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

13 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

Related Questions

how to make game object animation without animator visible to all players in photon pun? 2 Answers

Network Animator not syncing with Clients in Netcode 0 Answers

hi i need help with code 1 Answer

How to use RPC functions to animate other players 1 Answer

Unity MLAPI ServerRPC not getting called 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