• 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 David C · Jun 05, 2011 at 11:05 PM · physicsrigidbodycolliders

a rigid body without physics?

hello, i have a situation were i need an object to collide with another object and the two to just stop and do nothing. as in, not to bounce away from each other but not pass through each other.

i have the two objects with box colliders, one kinematic and one not. i learnt that if both are kinematic they just pass through each other. So is there a way to have both objects kinematic, and so not affected by physics, but not to pass through each other?

thanks in advance! might be a noobish question

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Bunny83 · Jun 06, 2011 at 12:35 AM

Physics is what they made to not pass through each other. If you control the objects yourself (kinematic rigidbodies) there's nothing what the collision system could do when you move one into another. Physics can apply forces to prevent intersection.

What you can do is to turn the collider into trigger. Then you can check for collisions yourself.

A Rigidbody represents a physics object nothing else. A kinematic rigidbody is just a tool that allows one-way physics interactions.

edit

It should also be possible to use Rigidbody.SweepTest or Rigidbody.SweepTestAll with kinematic rigidbodies. It just simulates the movement and tells you if and where it would collide but doesn't move it actually. That way you can handle the collisions the way you want.

Comment
Add comment · Show 4 · 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 Eric5h5 · Jun 06, 2011 at 12:55 AM 1
Share

At least one of them still needs to be a rigidbody, or else OnTriggerEnter won't fire.

avatar image testure · Jun 06, 2011 at 12:57 AM 2
Share

my thinking is that he's potentially using rigidbodies for a reason (maybe a physics marble game or something like that), and needs an object to act like a stopper.. which is why I suggested zeroing out the velocity as a simple solution.

avatar image Bunny83 · Jun 06, 2011 at 01:16 AM 0
Share

@Eric5h5: yeah, right... I will change that.

@testure: That doesn't make much sense :D The question states that he wants no physics. But in such a case you described it would be the best solution (trigger or raycast)

avatar image testure · Jun 06, 2011 at 01:18 AM 0
Share

Well, if you read it literally sure. But I like to give people the benefit of the doubt- if they're using a rigidbody, I assume they have a reason for it unless it's phrased in a way that leads me to believe that they're utterly lost ;)

avatar image
0

Answer by testure · Jun 05, 2011 at 11:22 PM

You could always check for collision via raycast, trigger, or any other relevant method, and then if it's detected, zero out your velocity. That would probably be the simplest method.

Comment
Add comment · Show 2 · 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 David C · Jun 06, 2011 at 07:19 AM 0
Share

@testure that sounds like what i am after. thank you, how do i zero out velocity?

avatar image David C · Jun 06, 2011 at 07:23 AM 0
Share

never $$anonymous$$d my other question has already been asked! thanks for all the help guys answers.unity3d.com/.../how-do-i-zero-out-the-velocity-of-an-object.html

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Problem with Colliders 1 Answer

How to keep objects from passing through colliders 2 Answers

Active rigidbodies and number of Contacts 1 Answer

Player with RB + capsule collider can easily penetrate ALL kinds of primitive colliders. What do I do to fix this? 2 Answers

Moving a regular Unity primitive and PhysX performance 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