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
2
Question by rednax20 · Apr 19, 2014 at 05:01 PM · rigidbodycharactercontrollercollision detectionpushing

Stop objects from going through each other with rigidbodies

okay, I'm trying to create a game where the player moves around using transform.translate. i put a rigidbody on him and all of his surrounding objects (walls in this case) to handle collisions

there's a problem. if the player runs into a wall he sort of moves into it, if you keep holding the foward button he pushes into it more so. It's gotten to the point that the character can push through to wall. overlapping the wall a bit is okay, but moving through it is something else entirely

If i push into a wall and stop going forward i get pushed away, but if not, again, i can move through walls

is there a way to make the rigidbody collisions stop you from moving entirely??? i have tried using rigidbody.addforce instead, but it still moves through the walls

i think i may need to use a character controller, but i don't know how to use them. i tried to learn a while back but it proved to be quite a hassle. is there anyway to do this with rigidbodies?

sorry this question is so vague, any and all help is greatly apprecieated

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 rednax20 · Apr 19, 2014 at 05:03 PM 0
Share

i forgot to note, all of the walls rigidbodies have all of their restraints checked and my object has all of it's rotation restraints checked

hope this helps

avatar image robertbu · Apr 19, 2014 at 05:39 PM 0
Share

Go to:

 Edit > Project Settings > Physics.

Reduce or set to 0 $$anonymous$$in Penalty for Penetration.

Go to:

  Edit > Project Settings > Time

Reduce the value for 'Fixed Timestep'. I believe the default is 0.02. Try 0.01.

Neither of these are complete fixes, but often they can drastically reduce the problem. One issue is that if you moving through the transform, you are teleporting from one position to another. It can make collision detection fail.

avatar image rednax20 · Apr 21, 2014 at 02:24 AM 0
Share

thanks your code help the character a bit... but It still sort of presses into the wall which causes more problems then i cared to note before. so i am still stuck, thanks for the help though, it really does help, I just think that i am going to have to do this with a character controller

1 Reply

· Add your reply
  • Sort: 
avatar image
-2

Answer by getyour411 · Apr 19, 2014 at 05:25 PM

http://answers.unity3d.com/questions/203989/rigidbody-player-goes-through-wall.html

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 rednax20 · Apr 21, 2014 at 02:29 AM 0
Share

The question you left a link to didn't help me at all. I don't understand why you put it as an answer.

The two solutions given to the persons problem were using velocity, which i said I tried addforce already (i tried velocity too but i thought saying that would be redundant) the other was to use a character controller, which i said i did not want to use

so are you telling me i need to learn to use a character controller? if not, please elaborate more than just posting a link to a question without explaining what i am supposed to understand from it.

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

20 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Problem with CharacterController collision detection 1 Answer

Character not moving on slopes 1 Answer

How to handle movement in a multiplayer FPS? 0 Answers

character controller + physics 1 Answer

Sphere + rigidbody + character controller 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