• 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
1
Question by UnityNoOb18 · Jun 06, 2011 at 12:50 AM · movementfalling-through-floor

Sphere falling through floor

I made a little setup by following the tornadotwins tutorial on youtube with a sphere and i cant get it to work. The sphere keeps falling through the floor. This is my script i have applied to my sphere.

var speed = 3.0; var rotateSpeed = 3.0;

function Update () { var controller : CharacterController = GetComponent(CharacterController);

 // Rotate around y - axis
 transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
 
 // Move forward / backward
 var forward = transform.TransformDirection(Vector3.forward);
 var curSpeed = speed * Input.GetAxis ("Vertical");
 controller.SimpleMove(forward * curSpeed);

}

@script RequireComponent(CharacterController)

Comment
Add comment · Show 3
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 hellcats · Jun 06, 2011 at 06:32 AM 0
Share

Is it always falling through the floor, or only sometimes? Quick things to try: Is it starting out already inside the floor (click on it and look at the green collision capsule. Is it under the floor?) Try raising it a little off the floor so it falls before hitting.

If that doesn't work, then try removing the character controller and replacing it with a rigidbody. Add a sphere collider to it. Now see if that collides with the floor. (Remember to disable your script or you'll get an error about when you try to access the CharacterController). If that still doesn't collide then look at your Time settings. Fixed timestep should be something like 0.02 or 0.01. Last check your Settings->Physics->Layer Collision $$anonymous$$atrix. $$anonymous$$ake sure the two layers of your sphere and ground are enabled to collide

avatar image reapex · Jun 13, 2011 at 12:17 AM 0
Share

@UnityNoOb18 I solved the issue by making a brand new project that is not based on an existing project, such as Boot Camp Demo

avatar image ErikReichenbach · Feb 26, 2017 at 12:52 PM 0
Share

One thing I have discovered is that applying the controls to the ball itself makes the rotation of the object change the direction of the input.

For example: roll onto the left side, and now your left input control is facing down, through the floor. Hitting the ball "left" therefor works to push the ball through the floor plane.

11 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by DaveA · Jun 06, 2011 at 01:01 AM

You did put a collider on the floor, right? And nothing is set to 'is trigger'?

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
1

Answer by UnityNoOb18 · Jun 06, 2011 at 01:21 AM

the floor is a cube and it has a box collider and mesh renderer the sphere has a mesh renderer character controller the script attatched to it a sphere collider and a rigidbody.

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
1

Answer by reapex · Jun 06, 2011 at 01:29 AM

I am having the same issue, with Unity 3.3, the floor is has a box collider and a rigid body. The sphere has a sphere collider and the following script:

var speed = 3.0; var rotateSpeed = 3.0; function Update () { var controller : CharacterController = GetComponent(CharacterController); transform.Rotate(0, Input.GetAxis ("Horizontal") rotateSpeed, 0); var forward = transform.TransformDirection(Vector3.forward); var curSpeed = speed Input.GetAxis ("Vertical"); controller.SimpleMove(forward * curSpeed); } @script RequireComponent(CharacterController)

The ball still falls through the floor.

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
1

Answer by UnityNoOb18 · Jun 06, 2011 at 01:59 AM

Yeah I dont know i wish there was a fix to this

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
1

Answer by raymond.du · Jun 06, 2011 at 03:22 AM

it's moving too fast. The collider missed by a frame. http://www.unifycommunity.com/wiki/index.php?title=DontGoThroughThings

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
  • 1
  • 2
  • 3
  • ›

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

9 People are following this question.

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

Related Questions

Expecting ':' Found '=' Error 1 Answer

Character Movement and Jumping Script? 4 Answers

Movement script 2 Answers

Camera Script - Bird's Eye View 1 Answer

Help with Grid movement script + AI script 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