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 unity_lSXJSIZAvqe3Qw · May 27, 2020 at 08:55 PM · animationanimatorjumpanimator controllerjumping

I am slowly falling down with the jump animation

Hello everyone, have have some small issue, but i still can't understand, what;s wrong. I have jump system: Character (with capsule collider and rigid body, and they set up properly), Empty gameobject with ray, for detecting is Player grounded Before i added jump animations - everything worked correctly. I have 3 jump animations

  1. Anticipation

  2. Floating

  3. Landing


When Floating is playing - my character falling really slow, without animation I have normal fall speed Here is my code

 public class Jump : DragControllerForwad
 {
     public float jumpHeight = 10f;
     public bool isGrounded;
 
     //Character rigid body
     public Rigidbody rb;
 
     //Character animator
     [SerializeField]
     Animator anim;
 
     void Start()
     {
         rb = transform.Find("animation").GetComponent<Rigidbody>();
         anim = transform.Find("animation").GetComponent<Animator>();
     }
 
     void Update()
     {
         RayCasting();
     }
 
     // Ray for detecting ground
     protected override void RayCasting()
     {
         Ray ray = new Ray(transform.position, transform.forward);
         RaycastHit hitInfo;
 
         if (Physics.Raycast(ray, out hitInfo, .5f))
         {
             Debug.DrawLine(ray.origin, ray.origin + ray.direction * .5f, Color.green);
             if (hitInfo.collider.tag == "Ground")
             {
                 isGrounded = true;
             }
             else
             {
                 isGrounded = false;
             }
         }
         else
         {
             isGrounded = false;
             Debug.DrawLine(ray.origin, ray.origin + ray.direction * .5f, Color.red);
         }
 
         // Code for jump animations
         if (isGrounded == true)
         {
             anim.SetBool("isJump", false);
             if (Input.GetKeyDown(KeyCode.Space))
             {
                 rb.AddForce(Vector3.up * jumpHeight, ForceMode.Impulse);
             }
         }
         else if(isGrounded == false)
         {
             anim.SetBool("isJump", true);
         }
     }
 
 }

My animator controller: alt text

answer.png (97.6 kB)
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 tadadosi · May 27, 2020 at 11:19 PM 0
Share

Is your animator on the same gameobject as the rigidbody / collider? $$anonymous$$aybe making your animator a child of your player gameobject could fix the problem, I'm not entirely sure and cannot test at the moment, but it might be that your animation is overriding the physics and by making it a child you could avoid that.

avatar image unity_lSXJSIZAvqe3Qw tadadosi · May 28, 2020 at 07:31 AM 0
Share

I am sorry, but I didn't understand, how to make animator child of a player, thanks for response!

avatar image unity_lSXJSIZAvqe3Qw tadadosi · May 28, 2020 at 07:33 AM 0
Share

And yeah, animator is on the player, and he has rigb and capsule collider.Idk if it's important, but I have these constraints on rb: freeze position on z, and freezed all kinds of rotation

4 Replies

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

Answer by unity_lSXJSIZAvqe3Qw · May 28, 2020 at 01:17 PM

I finally found out how to fix it, if you guys will have the same problem - try tu turn off allow root animation in your animator in inspector

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 volkankk · Apr 07, 2021 at 10:36 AM 0
Share

Yes but this time the character stops moving with the animation, it is stationary even in the walking animation

avatar image
1

Answer by Jakeiiii · May 28, 2020 at 07:46 AM

There doesn't seem to be any clear indication in your code as to when your player is in the "floating" state. There isn't any specific "Float" animation, nor is there a boolean or enum value to check whether it is. And I assume that in the "floating" state you don't want any vertical velocity at all; and also that this "floating" only happens at the peak of your jump, correct? And what is the length of the floating determined by? Is it the length of the animation? The length of the jump button being held down? Once you can define what exactly this "floating" state is and how it functions then I can provide some help as to how to keep the character still in the air during this time.

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 unity_lSXJSIZAvqe3Qw · May 28, 2020 at 08:58 AM 0
Share

Yeah, my bad, that's my first time one this forum. Floating - is the period when anticipation ends. In two words - jump end. And untill isGrounded is false, character saves last pose from previous jump animation. When he is "floating" he falls really slow down, and when he hits the ground - landing animation executing. So the main issue - slow falling

avatar image
0

Answer by N-8-D-e-v · May 27, 2020 at 09:58 PM

Try editing the gravity scale in the Rigidbody of your player. Or go to the project settings and adjust the default gravity,

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 unity_lSXJSIZAvqe3Qw · May 27, 2020 at 10:20 PM 0
Share

without animation i have normal gravity

avatar image
0

Answer by tadadosi · May 28, 2020 at 12:14 PM

Edit: Previous answer: Try moving your Animator away from the Player gameobject, make it a gameobject child. Also make sure that your code finds the animator after you made the change.


New answer: Sorry about the last one. You shouldn't be moving your animator away, you should be creating a new gameobject called player and move all your behaviour and collider in there and leave just the animator in what's your current Player. If you remove the animator from the current player, it will not work because the animator will be looking for the previous hierarchy and will not find it.


So basically:

  1. Rename your current Player to Animator.

  2. Create a new empty object in the same position as the Animator.

  3. Paste all your behaviour and colliders to the new object.

  4. Remove all the behaviour from your Animator.

  5. Make your Animator a child of your new Player.

  6. Test.

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 unity_lSXJSIZAvqe3Qw · May 28, 2020 at 01:15 PM 0
Share

I did as you showed me, but after this none of my animations executes

avatar image tadadosi unity_lSXJSIZAvqe3Qw · May 28, 2020 at 01:36 PM 0
Share

Oops, I know what went wrong, I'll fix my answer in a moment, sorry about that.

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

409 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image 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

Animating scripted jumping 1 Answer

I can't see or access a state in the Animation Controler 1 Answer

Animation from child object overrided by its parent and won't show in game window 0 Answers

Applying permanent mask to player animators walk 0 Answers

Animator displaying wrong states 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