• 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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by Theroper · May 21, 2010 at 06:18 AM · colliderthird-person

character model sinks through floor?

I have been following a tutorial using the unity 3d engine and came to the part where you use the script to make your model controllable? I'm new to unity so i'm not exactly sure how to explain it. When i run the script my sphere (which is my temporary player) just falls through the floor, as if It has no colliders.

here's the script, maybe I'm missing something?

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)

How do you add a collider to the Ground?

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

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by DaveA · Jul 13, 2011 at 08:45 PM

I've seen this when I add a character (like the soldier from the Locomotion demo) who is 100 times too big. So you set scale to .01 to make it look right. But now the character controller is 100 times too small. So set its height to like 200 and radius to 50

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 Ony · May 21, 2010 at 06:28 AM

Do you have a collider on your floor? Make sure to set it with one and then make sure the character is set above it a bit to start.

Comment
Add comment · Show 3 · 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 Theroper · May 21, 2010 at 06:31 AM 0
Share

How do I add a collider to the floor? I thought that might be what was wrong but they skipped that i think.. :(

avatar image Cyclops · May 21, 2010 at 03:07 PM 0
Share

@Theroper, if you created a Terrain, it automatically has a collider. Only if you created your own object as the floor/ground, would you need to add one. Also, as @Jak said - make sure it's above the ground. It could be falling through.

avatar image Ony · May 21, 2010 at 09:57 PM 0
Share

@Theroper: If you made your own floor then pick it in your scene then choose "Components/Physics/Box Collider" from the menu. That will add a collider to your floor.

avatar image
0
Wiki

Answer by lampshade · Dec 04, 2010 at 04:16 AM

It's funny sometimes (for this developer); when needing to fire projectiles it seems that I can't envelop my model in a capsule collider (the projectiles collide with it), thus, I had to use a 'MeshCollider'. I then added a 'box collider' ONLY enveloping the feet (as best I could). The Character then, does not fall through the floor.

Hope this helps...

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.

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

1 Person is following this question.

avatar image

Related Questions

Third Person Char detected onTrigger but not onCollisionEnter 0 Answers

change first person controller collider to cube 1 Answer

Internal collisions 1 Answer

how to check if one object is colliding with another 1 Answer

Arongranbergs Astar DynamicGridObstacle deletes nodes from gridgraph 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