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 mhhk88 · Apr 19, 2014 at 12:14 AM · jumpreal

how to make jump naturally?

I've been studying this matter but it's not easy for a beginner. This is what I want to implement. A character jumps. It goes up fast at first, gets slow down and the gravity applies at the top and fall. Like a real jump. I wonder how to control the speed.

Can anyone help me with this? Any advise will be so appreciated.

Comment
Add comment · Show 6
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 robertbu · Apr 19, 2014 at 12:35 AM 1
Share

The possible solutions will depend on how you are moving your character (Rigidbody, CharacterController, Transform), and how your character interacts with the rest of the scene. For a Rigidbody, you can just do a one-time AddForce() and let gravity take over. For a Transform, you can use the $$anonymous$$athf.Sin() to calculate height over time.

avatar image mhhk88 · Apr 19, 2014 at 12:50 AM 0
Share

Thank u so much for your comment. I will try the addforce() method because it sounds easier than the other one. But I am very interested in that method too. So can I see the Sin() method anywhere? It will be very helpful for me to find some source codes.

avatar image robertbu · Apr 19, 2014 at 12:54 AM 0
Share

Here is one answer that uses a $$anonymous$$athf.Sin() to make a jump.

http://answers.unity3d.com/questions/406386/jumping-without-character-controller.html

Also the physics calculations associated with jumping are not too complex and can be used in coding a CharacterController jump.

avatar image mhhk88 · Apr 19, 2014 at 03:08 AM 0
Share

Thanks again. You put me up by one level in program$$anonymous$$g.^^

avatar image mhhk88 · Apr 19, 2014 at 03:32 AM 0
Share

It works beautifully. By the way, can I use tan() for the opposite case ? I mean an object move slow and getting faster. Sorry to keep asking...

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by SteelArrow21 · Apr 19, 2014 at 12:50 AM

Make sure the player has a rigidbody.

Javascript (May need tweaking):

 var jumpForce = 400;
 
 function Update() {
 
 if(Input.GetKeyDown("space"))
      rigidbody.AddForce(Vector3.up * jumpForce);
 
 }

C#:

 public int jumpForce = 400;
 
 void Update(){
 
 if(Input.GetKeyDown("space"))
      rigidbody.AddForce(Vector3.up * jumpForce)
 
 }

Adjust the jumpForce through the inspector until it gets just right. It all depends on the size of your player and the gravity. Hope this helps.

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 mhhk88 · Apr 19, 2014 at 03:09 AM 0
Share

WOW!!!!!! Is it that simple? Thank u. Gotta run to test this^^

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

Jumping in 3D 1 Answer

I also used to check is grounded raycast and OnCollisionEnter2D but still there was such a problem. 0 Answers

How can I change jump direction? 1 Answer

Hey Guys I have a problem with a single jump script. 1 Answer

Why does my character jump higher sometimes? 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