• 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
Question by patrickjong123 · Mar 09, 2021 at 05:25 PM · 3djumpjumpingjumping object

I cant make my character jump

Whatever I do, my 3d character does not want to jump (increase y axis). I have a cam that follows the object. It moves up but the object is not moving up.

rb.AddForce(new Vector3(0, 5, 0), ForceMode.Impulse); //I use this when hitting spacebar

Comment

People who like this

0 Show 4
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 Jopa-Przemyslaw · Mar 09, 2021 at 07:54 PM 0
Share

Have you tried increasing the jumpHeight variable? Bump it up and let us know here if it does sth.

avatar image patrickjong123 Jopa-Przemyslaw · Mar 11, 2021 at 02:56 PM 0
Share

It doesnt jump at all, 50 or 100 doesnt work

avatar image logicandchaos · Mar 09, 2021 at 08:59 PM 0
Share

can you share the rest of your code? Where do you call this?

avatar image patrickjong123 logicandchaos · Mar 11, 2021 at 03:02 PM 0
Share

So when I put this jumping script on a empty cube, the cube flies into the air. However my PlayerObject does not.

![picture][1] [1]: /storage/temp/177378-jumping-script.png

jumping-script.png (102.5 kB)

1 Reply

  • Sort: 
avatar image

Answer by UnityM0nk3y · Mar 09, 2021 at 05:36 PM

Assuming you are in 2D with a Rigidbody2D:

This code will make you jump by using the "W" key.

 Rigidbody2D rb2d;
 public float jumpHeight; //adjust me in the editor
 
  void Start()
  {
        rb2d = gameObject.GetComponent<Rigidbody2D>();
       jumpHeight = 20f; //how high you want to jump
  }
 
 void FixedUpdate()
 {
         if (Input.GetKeyDown("w"))
         {
             rb2d.AddForce(Vector2.up * jumpHeight);
         }
 }
Comment

People who like this

0 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 patrickjong123 · Mar 11, 2021 at 02:56 PM 0
Share

My situation is for 3D, I have added this to my question :)

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta on June 13. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

117 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

Related Questions

I have a problem with my jump script 1 Answer

3D Game-Making a character jump 3 Answers

Jumping only once (2D) 2 Answers

jump and check ground problem! 2 Answers

change multiple jump to single jump 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