• 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 Tanoshimi2000 · Sep 16, 2018 at 08:39 PM · physicsrigidbodygravity

Gravity slow descent after jump

Basically my character jumps to the correct height, then slowly floats down until/unless I move them, then gravity resumes normally. I can't jump straight up and down without slow descent.

Tried AddForce and velocity. Both work for the jump, but both slow the descent unless I move.

     public void LeaveGround()
     {
         // Add physics to the jump
         RB.AddForce(transform.up * JumpHeight * 2f, ForceMode.Impulse);
     }
Comment
Add comment · Show 7
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 Kaskorian · Sep 16, 2018 at 11:13 PM 0
Share

First some basic questions. $$anonymous$$aybe there is already the error or we can rule it out and conclude on more complex mistakes/errors.

  1. Is there just this one line of code where you apply force to the object or change the velocity, or does your code contain any other behavioral elements?

  2. Have any changes been made in your Physics or Physics2D settings or are there any settings that you find strange? If so, then maybe add to the question (as a screen).

  3. (very unlikely) It may come to a bug because you are working with the local coordinate system and not with for example Vector3.Up.

avatar image Tanoshimi2000 · Sep 17, 2018 at 12:02 PM 0
Share

@$$anonymous$$askorian Thanks for the response. I do have one other section where movement is applied based upon the input. // read inputs float h = CrossPlatformInput$$anonymous$$anager.GetAxis("Horizontal"); float v = CrossPlatformInput$$anonymous$$anager.GetAxis("Vertical"); bool crouch = Input.Get$$anonymous$$ey($$anonymous$$eyCode.C);

         // Update animation
         // update the animator parameters
         m_Animator.SetFloat("Forward", (v * RunSpeed) + (h * TurnSpeed), 0.1f, Time.deltaTime);
         m_Animator.SetFloat("Turn", h, 0.1f, Time.deltaTime);
         m_Animator.SetBool("OnGround", true); // m_IsGrounded
         m_Animator.SetFloat("Jump", RB.velocity.y);
 
         // $$anonymous$$ove the character
             transform.Rotate(0, h * TurnSpeed, 0);
             RB.AddForce(transform.forward * v * RunSpeed, Force$$anonymous$$ode.Impulse);
         

Incidentally, I'm able to watch the Velocity.y value, and it goes positive on the way up, negative during correct speed fall, but then hits zero and the descent slows.

No other changes to Physics in the code or editor.

When it's falling slow, if I move or rotate, then gravity resumes normally. I took out the on_ground checks so that I could do that, rather than waiting a $$anonymous$$ute for touchdown.

avatar image Kaskorian · Sep 17, 2018 at 01:34 PM 0
Share

Okay next, just to imagine: how exactly does the jump go? I'm just trying to reproduce the mistake. When I use your LeaveGround method, the jump works normally.

So how exactly does he work for you? You mean your object jumps normally but falls too slowly. If this already occurs at the highest point, so jump up to JumpHeight -> velocity.y approaches 0 -> At the highest point velocity.y = 0. Does the error occur from there on? Is the fall speed just lower than it should be or is it something more special. You mean the value is negative when falling down, as it should be, until it reaches 0. At which point in time or at which point velocity.y reaches a value of 0 as well as at the highest point.

Show more comments

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

175 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

Related Questions

Physics for ball on an incline: rolling up a hill if half way up 1 Answer

WheelCollider: Car on boat. Car is pushing boat. CAUSE: WheelCollider (Suspension?) 0 Answers

Start falling through ground in one frame and in the next frame everything is good. 0 Answers

Is it possible to change gravity for only one object? 1 Answer

How to change player gravity in a 3d space? 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