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 Systemfre1 · Aug 29, 2014 at 05:54 PM · collidercollidersmesh collider

I can walk through an object with a mesh collider?

So I created this small model for a room. It's a box with its normals inverted so I can see the walls on the inside. It's also one sided so I can see through it from the outside. In Unity I check the Generate Colliders option and add into the game world. But when I move my character, from the inside, to the wall. instead of bumping into it he walks straight through, why is this? and how do I fix it?

My character also has a collider on it.

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 Systemfre1 · Aug 29, 2014 at 08:46 AM 0
Share

$$anonymous$$y character also has a collider

avatar image Systemfre1 · Aug 29, 2014 at 09:42 AM 0
Share

$$anonymous$$ight have nearly solved this myself sorry :( I think it's something to do with my movement.

 transform.Translate(Vector3.forward * Input.GetAxis("Vertical") * moveSpeed * Time.deltaTime);
avatar image Scribe · Aug 29, 2014 at 06:05 PM 0
Share

is your movement being called in Update or FixedUpdate? have you got a rigidbody on your object? Using forces for movement may work better!

avatar image robertbu · Aug 29, 2014 at 06:08 PM 0
Share

Assu$$anonymous$$g the object inside the box has a Rigidbody, use Rigidbody.$$anonymous$$ovePosition() rather than Transform.Translate()...or use Rigidbody.AddForce() or set Rigidbody.velocity.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by DrakeDiablo · Aug 29, 2014 at 06:05 PM

Because you are inside the collider, since your room is a box, that means that mesh collider is going to create a big box, and it will only detect collisions on the outside. If you want to make a room, put together like 6 cubes, each being for a wall and ceiling. Hope this helps! :D

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 robertbu · Aug 29, 2014 at 06:07 PM 0
Share

Actually, if the normals are pointing inward as indicated, then the inside surface should be the one he is colliding with.

avatar image
0

Answer by Systemfre1 · Aug 29, 2014 at 07:29 PM

Thanks, for your answers. But I found the problem and fixed it.

Because my movement was transform.Transalte it was forcing its way through anything, because it techincally wasn't moving. It was acting more like a teleport.

I replaced it with

 if (cc.isGrounded) {
         moveDirection = new Vector3 (Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical"));
         moveDirection = transform.TransformDirection (moveDirection);
         moveDirection *= moveSpeed;
                 }
             moveDirection.y -= gravity * Time.deltaTime;
             cc.Move(moveDirection * Time.deltaTime);

My only problem now is that I don't have the customization that I wanted for sprinting only when moving forward and stuff like that, but it doesn't matter to much to me.

Hope this helps if someone encounters this problem in the future.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Adding colliders to human imported fbx - Newbie 1 Answer

RaycastHit2D hits "itself" 3 Answers

How can I do drilling using mesh colliders 0 Answers

boost and hit the edge of a collider and you go backwards 0 Answers

Colliders on this spider 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