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 sharpshot124 · May 04, 2012 at 02:31 AM · animationtransformmultiplayer

Multiplayer Animation

ok i know this is a commonly asked question but i have a specific case and do not understand why this isnt working i have this attached to each character

 var animator : Animation;
 var walk : String = "Walk_Forward";
 var strafe : String = "strafe";
 var run : String = "run";
 var idle : String = "idle";
 var jump : String;
 var walkAnimationSpeed : float = 2;
 var strafeAnimationSpeed : float = 2;
 var runAnimationSpeed : float = 2;
 var runThreshold : float;
 @HideInInspector
 var runWalkRatio : float;
 @HideInInspector
 var action : boolean = true;
 @HideInInspector
 var lastPos : Vector3;
 @HideInInspector
 var deltaPos : Vector3;
 var speedMagnitude : float;
 var weightFwd : float;
 
 
 function Start () {
 
 }
 
 
 function FixedUpdate () {
     action = false;
     deltaPos = transform.position - lastPos;
     speedMagnitude = deltaPos.magnitude;
 
     weightFwd = Mathf.Abs(Vector3.Dot(transform.forward.normalized, deltaPos.normalized));
     var walkSpeed : float = deltaPos.magnitude * weightFwd;
     var strafeSpeed : float = deltaPos.magnitude * (1 - weightFwd);
     
 
     if(weightFwd < .1){
         weightFwd = 0;
         animator.Stop(walk);
     }
     if(weightFwd > .9){
         weightFwd = 1;
         animator.Stop(strafe);
     }
 
     if(gameObject.GetComponent(PlayerMove).grounded){
         if(weightFwd > .2 && deltaPos.magnitude > .015){
             Forward(walkSpeed, weightFwd);
             action = true;
         }
     
         if(weightFwd < .8 && deltaPos.magnitude > .015){
             Strafe(strafeSpeed, 1 - weightFwd);
             action = true;
         }
 
     }
     
     if(!action){
 //        animator.Stop();
         animator.CrossFade(idle, .1);
     }
         
     lastPos = transform.position;                
 }
 
 function Forward (speed : float, weight : float) {
     animator[walk].speed = speed * walkAnimationSpeed;
     animator[run].speed = speed * runAnimationSpeed;
 
     if(deltaPos.magnitude > runThreshold)
         animator.Blend(run,runWalkRatio);
     else
         animator.Blend(walk, weight - runWalkRatio);
 }
 
 function Strafe (speed : float, weight : float) {
     animator[strafe].speed = speed * strafeAnimationSpeed;
     animator.Blend(strafe, weight, .1);
 }

so in theory each animation calculations and playing should happen locally (which is better than RPC as far as i understand) but except for player character the only animation that plays is the dle animation, so i kno that the animations are playing but why is it that the other animations will not play? is it because of how the transform is observed and updated, and more importantly how can i fix it?

Comment
Add comment · Show 1
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
avatar image sharpshot124 · May 04, 2012 at 02:31 AM 0
Share

sorry for the bad format idk why it did that

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Bunny83 · May 04, 2012 at 02:41 AM

I never used the Blend function but from what i can read from the scripting reference it just blends the animation weight, nothing more. It doesn't start (enable) the animation. Usually you would use either Animation.Play or Animation.CrossFade.

Alternatively you can of course set all parameters manually. Take a look at the AnimationState class which represents a concrete animation. However it's usually better to use one of the two functions above unless you need full control of all active animations.

Comment
Add comment · Show 1 · 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
avatar image sharpshot124 · May 09, 2012 at 11:22 PM 0
Share

i tried to do this but it changed nothing it what i really need to know is why it is not playing since it should be calculated locally. also if wat u say is the case about Blend() not starting the animation why does it work for rhe user player?

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

Unity Multiplayer - Animations - mesh subobject movements conveyed 1 Answer

Unity Photon: animation syncing 1 Answer

Network transform update happening only on one screen 1 Answer

Lipsync with phonem animations? 0 Answers

Correct way to spawn and move objects 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