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 Syllith · Nov 23, 2011 at 06:42 AM · charactercontrollerjumpdoublemotorswim

How to jump multiple times to mid air?

Okay, so I'm writing this swimming script, but I'm have some problems on the final core pieces of it. Right now, I have the game successfully identifying whether or not your under water. When you are, it it changes basic movement controls such as speed, gravity, fall speed, etc. That way, it makes it look like your swimming through water, even though it just modifies you movements and gravity. Now, I need to make it so you can swim up and get to the surface. Right now, all you do is sink to the bottom. When you jump, you move up slowly, but eventually sink back to the bottom. I want the player to be able to press the space bar in mid air, and the character would jump again, even if they are not grounded. It's similar to the swimming controls in Minecraft.

I'd like to simply be able to modify the existing CharacterController.js script if that's possible. Any idea's or alternate ways?

Comment
Add comment · Show 1
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 FLASHDENMARK · Nov 23, 2011 at 09:06 AM 0
Share

There are many ways of doing this. If we write something from the top of our head, it would maybe not fit your scenario that well. If you post some code, it would be more easy for us to help you.

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by brumdogpro · Nov 24, 2011 at 09:35 PM

I don't know how your code looks but you can add a boolean value such as "isUnderwater" to the scripts and set it to where the player can jump:

 if(isGrounded || isUnderwater)
 {
 
 }

That is the approach I would probably take. Hope I helped out a little.

Comment
Add comment · 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
0

Answer by Kacer · Nov 24, 2011 at 11:12 AM

You can access a "IsGrounded" bool in the charactercontroller from another script, if you forcefully set that to false you're able to jump indefinately.

Comment
Add comment · 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
0

Answer by DavidDebnar · Jan 30, 2013 at 01:57 PM

Link to my answer on another question:

Double Jump?

Comment
Add comment · 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

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Natural Jump algorithm 2 Answers

Joystick - movement and jump in the same direction 0 Answers

i'dont want double Jump 1 Answer

Modifing Standard Assets FPC to swim 0 Answers

controller.Move not working correctly 0 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