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 DanMarionette · Mar 22, 2015 at 07:25 PM · unity 5rigidbodyvelocityjumpwheelcollider

Setting Rigidbody Velocity for Jump Unity 5

Hi,

I have a basic vehicle with a rigidbody and four wheelcolliders. I want the vehicle to jump and I have always been setting the 'up' velocity directly to make the jump predictable. This has always worked in Unity 4, but since upgrading if you keep jumping in rapid succession the jump is very unstable. I have been outputting the rigidbody velocity to console after the jump and I am not getting the result I have set it too. Does anyone have any ideas what has changed in version 5 to cause this? I susspect it might have something to do with the wheelcolliders. I'm struggling to get them to perform the same as unity 4.

Thanks

Here is the jump code.

 public void Jump(float jumpForce, bool isChangingLanes = false)
         {
             if (!IsGrounded())
                 return;
 
             if (!IsHandcarOnJumpableSurface())
                 return;
 
             _isGoingToJump = true;
             _isChangingLanes = isChangingLanes;
 
             var velocity = _rigidbody.velocity;
 
             Debug.Log(string.Format("Pre Jump Velocity: {0}", _transform.InverseTransformDirection(velocity)));
 
             PrepareHandcarForJump(velocity);
 
             velocity += Vector3.up * jumpForce;
 
             _rigidbody.velocity = velocity;
 
             Debug.Log(string.Format("Post Jump Velocity: {0}", _transform.InverseTransformDirection(_rigidbody.velocity)));
         }
 
         private void PrepareHandcarForJump(Vector3 velocity)
         {
             velocity.y = 0;
 
             var rotation = _transform.rotation.eulerAngles;
             _transform.rotation = Quaternion.Euler(new Vector3(0f, rotation.y, 0f));
 
             _rigidbody.angularVelocity = Vector3.zero;
         }
Comment
Add comment · Show 2
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 $$anonymous$$ · Mar 22, 2015 at 09:25 PM 0
Share

Have you made sure you aren't using something such as Input.Get$$anonymous$$ey ins$$anonymous$$d of Input.Get$$anonymous$$eyDown

avatar image DanMarionette · Mar 22, 2015 at 10:13 PM 0
Share

I'm definitly using Get$$anonymous$$eyDown

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.

Follow this Question

Answers Answers and Comments

21 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

Related Questions

how to limit horizontal input when jumping 1 Answer

how to set initial speed of vehicle 1 Answer

How dose seting the velocity of a GameObject with Rigidbody.velocity work with unity 5 huminoid animation? 0 Answers

Inconsistent Jump height 3d 3 Answers

Velocity powered rigidbody on a moving platform without parenting. 3 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