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 kk93 · Feb 02, 2014 at 12:01 AM · collisionrigidbody

Object going through (or getting inside) another object

I am having an issue where a player object goes through (or gets inside) another object every once in awhile. I have heard of a "bullet through paper" problem, but I have done everything (as far as I can tell) to solve this issue.

  • I set collision detection on every object in the scene to Continuous Dynamic

  • I made the wall very, very thick

  • I set max speed of the player object to 30

The most annoying part of my problem is that I do not know what parameter causes this issue. I literally have to continuously bump my player object into a wall for about a minute to have it go inside a wall.

Anyways, is there anything else I can do to try to fix this issue?

Thanks!

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by markmmiller · Feb 02, 2014 at 12:13 AM

How are you moving the object?

Collisions will only be calculated for the object if you move using the MovePosition, AddForce or velocity methods on the rigidbody. Using a simple vector translate is often the cause of this problem.

The other cause is to ensure that the object has colliders attached and that they are NOT set to triggers. The other one is that the rigidbody is not kinematic either.

As well as this mesh colliders cannot collide with other mesh colliders. As such for more complex objects sometimes it is better to use simple bounding boxes for the collisions as opposed to auto generated mesh colliders.

Comment
Add comment · Show 5 · 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 kk93 · Feb 02, 2014 at 12:21 AM 0
Share

_body.velocity = new Vector3 (0, 0, 0);

float speed = $$anonymous$$athf.$$anonymous$$in (sw.speed * 0.0015f, 15);

_body.AddForce (new Vector3(sw.direction.x, 0, sw.direction.y)*speed);

This is how I am moving it. sw.speed being the swipe speed.

Also, when I make the walls not kinematic, the player object gets stuck :(

avatar image kk93 · Feb 02, 2014 at 12:24 AM 0
Share

also, I am just using Box Collider and Capsule Collider.

avatar image markmmiller · Feb 02, 2014 at 12:43 AM 1
Share

Hmm I'm not too sure then in that case.

I would probably try multiplying the speed by Time.deltaTime ins$$anonymous$$d of 0.0015f since that would make it frame independant.

Generally things only get stuck if they move too fast so I'm not too sure.

Where does the player get stuck when the walls are not kinematic?

avatar image kk93 · Feb 02, 2014 at 01:04 AM 0
Share

Hmmm... when I use Time.deltaTime, it goes through the wall a lot easier -_-

Anyways, when the walls have kinematic off, the player objects goes into the wall half way, then gets stuck. It usually bounces off the wall

avatar image kk93 · Feb 02, 2014 at 02:13 AM 0
Share

I learned that this happens on the 90 degree corner. I fixed the problem by placing a small wall in the middle to make two 45 degree angle. It actually looks more aesthetically pleasing anyways. Thanks for the help markmmiller!

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

19 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

Related Questions

Physics AddForce reduced when 3 objects are colliding 1 Answer

Custom Controller 1 Answer

Rigidbody stuck in colliders when moving and ricosheting. 0 Answers

OnCollisionEnter but have colliding object not move the object it collides with 1 Answer

Rigidbody magnitude comparison is not working correctlly? 2 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