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 xsk5 · Feb 07, 2015 at 03:55 PM · bugplatformer

Ground stops working and ball stops jumping

Hello there! I started learning Unity a few hours ago, fallowing some tutorials on the internet. I have made a very simple platform game, where a ball jumps from platform to platform by pressing W and moving with A and D. Very basic.

Eventhough, it looks like i made something wrong, cause I have 2 problems that show up.

1: sometimes the W (jump) doesnt work. In other words, when I want to jump from platform A to platform B and press W to do so, the ball won't react to it and just keep rolling. The funny thing is though that this only happens sometimes. Sometimes it works, sometimes it doesn't. I don't know why.

2: This one is pretty annoying. For some reason there is a limit to my level space: when I put a platform (the same as all the others, since I just copy the object) overpassing a limit in the map, the ground function stops working and the ball just falls through the object. It has something to do with the map, since I have moved the object to the side and then I can stand on one half but when I pass that certain point I just fall. I really don't know what the problem is.

I don't know if I made myself clear, maybe I should copy the script.

Anyway! Thanks in advance,

Here is the ball scrips (the ground has no scrips since it's a normal cube):

 #pragma strict
 
   var rotationspeed = 100;
 
   var jumpheight = 8;
 
   private var isfalling = false; 
 
   function Update () 
 
   {
     //Handle ball rotation.
     var rotation : float = Input.GetAxis ("Horizontal") * rotationspeed; 
     rotation *= Time.deltaTime; 
     rigidbody.AddRelativeTorque (Vector3.back * rotation); 
     
     if (Input.GetKeyDown(KeyCode.W) && isfalling == false) 
     {
         rigidbody.velocity.y = jumpheight; 
     }
     isfalling = true;
    }
 
    function OnCollisionStay () 
    {
     isfalling = false; 
    }

 
Comment
Add comment · 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 Mmmpies · Feb 07, 2015 at 05:02 PM 0
Share

Can't say for sure but check your colliders are where you expect them to be. If it suddenly drops through the floor then that implies a gape in colliders.

Could be the colliders are offset or could be a section of floor that the collider got deleted from.

avatar image xsk5 · Feb 07, 2015 at 05:14 PM 0
Share

Hm, How can I check that? It is strange though, cause i just copy the same object and the other work. And what about the jumping thing?

avatar image Mmmpies · Feb 07, 2015 at 05:21 PM 0
Share

You really are new :¬)

Highlight item in the Hierarchy one at a time and look in the scene, you should get a green line round the edge that represents the collider. Also look in the inspector for any that don't have a collider at all, or any that have become triggers. Triggers are colliders that allow something to pass through them.

Finally you really want to click on Learn at the top of this page and do a load of the tutorials on there.

avatar image xsk5 · Feb 07, 2015 at 05:32 PM 0
Share

So, checked the Collider, all seems to work. Don't know what the problem was.

Do you know something about my jump problem?

Is there a specific order you would recomend me to do the tutorials? Should I do the 4 games there and then move on with other stuff?

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Mmmpies · Feb 07, 2015 at 05:48 PM

The only thing I can think is that your isFalling bool is not set correctly. A good tip for debugging is run without MaximizeOnPlay set on the Game window. That way you can highlight the object with the script on it in the hierarchy and look in the inspector, you might have to make isFalling public to see it, not sure about JS.

As for tutorials, what works best for you is the way go go.

Sorry for any typo's, on my pbone!

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Platform Effector 2D (one-way) not working 0 Answers

Weird 2d platform problem 0 Answers

yeild WaitForSeconds Bugged 1 Answer

How can I stop the edges between my vertex-snapped cubes flickering? 0 Answers

2D 360 degress platformer example needed 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