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 Dqimass · Aug 27, 2016 at 06:04 AM · animationgameobjectanimatorcontrollerjump

Air jumping animation help

Hi guys, I haven't done unity in a while, so i forgot a lot stuff for coding. I was following the tutorial "2D Character Controllers" and things gone okay. The only problem i have is that when my player jump, the jumping animation didn't play.

         target = Camera.main.ScreenToWorldPoint (Input.mousePosition);
         if ((grounded || !doubleJump) && Input.GetMouseButtonDown (0)) 
         {
             if (target.x <= transform.position.x) {
                 anim.SetBool ("Ground", false);
                 GetComponent<Rigidbody2D> ().AddForce (new Vector2 (speed, jumpForce));
                 target.z = transform.position.z;
                 transform.localScale = new Vector3 (-1, 1, 1);
                 rb2D.velocity = Vector3.left;

I changed few thing when i follow the tutorial. I want my character to move AND jump using Input.mousePosition. My plan was to make my player constantly air jumping while dodging obstacles. that works okay but the only thing i need help with is

how do I play jumping animation every time my character jump?

Comment
Add comment · Show 3
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 Dream_in_code · Aug 27, 2016 at 06:43 AM 0
Share

can you post a picture of your animation controller?

avatar image Dqimass Dream_in_code · Aug 27, 2016 at 07:09 AM 0
Share

alt text

alt text

blend.jpg (144.7 kB)
blend-tree.jpg (90.2 kB)
avatar image Dream_in_code Dqimass · Aug 27, 2016 at 08:14 AM 0
Share

From Any State to swim what is the name of the transition used?

1 Reply

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

Answer by Dream_in_code · Aug 27, 2016 at 02:28 PM

Rigidbody2D myRB;

Animator myanim;

bool grounded = false;

void Start()

{

     myRB = GetComponent<Rigidbody2D>();
     myanim = GetComponent<Animator>();


}

void FixedUpdate() {

     grounded = Physics2D.OverlapCircle(groundcheck.position, groundcheckRadius, groundLayer);
     myanim.SetFloat("vSpeed", myRB.velocity.y);
     myanim.SetBool("Ground", grounded);
   

if (grounded && Input.GetMouseButtonDown (0))

{

         myanim.SetBool("Ground", grounded);  
         myRB.velocity = new Vector2(speed, jumpForce);


     }
Comment
Add comment · Show 2 · 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 Dqimass · Aug 28, 2016 at 09:33 PM 0
Share

thanks! it works 90%, the only thing bugs me a little is that the animation didn't play as soon as i move. it took like maybe 0.5 second later to play the animation. but other than that, Thank you so much

avatar image Dream_in_code Dqimass · Aug 29, 2016 at 04:02 AM 0
Share

Glad it worked :) for the delay part you can check settings of your Transitions. Check if the fixed duration or exit time has not been set correctly.

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

121 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

Related Questions

Object's sprite and collider are not at same position as transform 1 Answer

How can I activate my jump script only at my crouch animation ? 0 Answers

Skills controlled by animation (event callbacks and parameters) 0 Answers

Animation Change after changing pixel 0 Answers

Animation copy 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