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 H3core · Mar 19, 2013 at 04:07 AM · 2d

2d Game Jump Issue

Hi Unity,

I wrote a script that allows my player to jump bu adding force in the y direction, what im trying to achieve is disabling the character from jumping a second time before it actually hits something from below (ground, box, enemy, etc).

I tried using the get ground hit but thats only for wheel colliders. Thought of using filtered collisions by tags, and that would restrict me to ground, unless i tag other objects too ( i dont mind if i have to, but) that would include if i hit a box from the bottom for example which om trying to avoid.

Any suggestions, and solutions obviously welcome

Thnx in advance

Cheers :)

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by sona.viswam · Mar 19, 2013 at 06:18 AM

This is the best solution for jump of character controller. Please go through it.

jumping code of character controller

Change the axis according to the need.

HTH..

Comment
Add comment · Show 4 · 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 sdgd · Mar 19, 2013 at 06:24 AM 0
Share

what is that html you are posting?

says Server not found

avatar image Chronos-L · Mar 19, 2013 at 06:26 AM 1
Share

Here is the web link to CharacterController.$$anonymous$$ove, @sonaviswam posted the offline documentation link in his own PC.

avatar image sona.viswam · Mar 19, 2013 at 06:26 AM 2
Share

I am sorry. i edited the link.

avatar image Chronos-L · Mar 19, 2013 at 06:29 AM 0
Share

There was a 2D platformer project from Unity demo, with a very complete script on CharacterController. Unfortunately, the package is no longer there anymore.

avatar image
0

Answer by prototype7 · Mar 19, 2013 at 04:30 AM

if you have CharacterController on your player you can do this

 function Update() {
     var controller : CharacterController = GetComponent(CharacterController);
     if (controller.isGrounded) 
 {
   // do something
 }
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 H3core · Mar 19, 2013 at 06:05 PM 0
Share

Thank you guys for your feedback.

Unfortunately its not ending there, i added a character controller and was testing if i get collisions with a debug log, and it wasnt reporting anything. I created a empty game object to try to narrow down the issue and gave it just a controller on its own, addded a gravity script to it as well, since it conflicts with a rigidbody. and my object would not collide with the floor, it would just go straight thru.

Pulled out the 1st person controller prefab, and it collided just fine, discovered that i had to have a character motor script attached to my object, also was forced to follow the same setup in hierarchy and children setup as the 1st person prefab.

Thing is my game is a 2D game and im relying on mesh colliders, adding useless scripts such is character motor is really not good coding, is there anyway around this issue, where i can simple just add a character controller and have it collide normally with the floor (as i dont really need it to do so since im still gona have to leave my mesh collider on, but that would ensure that the controller is reporting collisions).

Thnks a lot guys ,didnt expect it to become so complex so fast.

Cheers :)

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

14 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

Related Questions

Strange Bounce after Parenting Objects on 2D Game 0 Answers

Using Texture Assets in Code 1 Answer

A node in a childnode? 1 Answer

Problem with a button made 2 Answers

Launching Projectile Problems (2D) 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