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 MirrorIrorriM · Dec 16, 2011 at 09:40 PM · collisionphysicsrigidbodymeshcollider.oncollisionenter

Checking collisions between two objects that don't have rigidbodies

Hello all. I know the question "how do you check for collisions between two colliders" has been asked a million times, but unfortunately none of the answers I have seen satisfy my problem. You see, at the core of what I am trying to do is a building block game, an easy example would be minecraft. However, unlike minecraft my system is not limited to blocks. I have many different shaped components such as thin plates, 45 degree angles, I-beams, etc. I have been thus-far using a Physics.CheckSphere function to make sure you don't place blocks and the like within each other. Problem is, with some parts, especially plates and 45 degree angles, a sphere check doesn't work very well at all. My next idea was to use Collider.OnCollisionEnter but that only works with non-kinematic rigidbodies! Since this is a builder without moving objects, rigidbodies would be problematic. In order to help illustrate my point, I have thrown together a picture that illustrates the problem.

alt text

As you can see, the slope is obviously not overlapping with the cube beneath it. Whereas the sphere collider worked for the cube on the other side, when you get a more irregularly shaped object such as the slope the system falls apart.

Is there any way to properly check for collisions using the part's collision mesh instead of a Physics.CheckSphere?

Note : You may have noticed that I was able to place a thin-block onto a ramp down there. That is because the Physics.CheckSphere checks collisions with the other object's mesh. So for placing objects ONTO something, the system works fine, so long as the object you are placing can easily fit a sphere inside it without problems.

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
0
Best Answer

Answer by MirrorIrorriM · Dec 18, 2011 at 07:36 PM

I figured out that, while OnCollisionEnter requires one of the colliders to have a non-kinematic rigidbody, OnTriggerEnter does not; a kinematic rigidbody WILL suffice. So I was able to make the object I am placing a kinematic rigidbody that has a trigger for a collider. In addition I had to shrink every object to be 99.99% of its normal size so the objects don't collide with each other by just being placed. Although this leaves a visible crease for some objects, I was able to incorporate a black line into the texture to compensate. So yeah, problem solved!

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

How may I observe expected physical interactions while using Rigidbody.MoveRotation()? 1 Answer

Object Flies into Air Upon Collision, or goes through hill depending on isKinematic settings 1 Answer

How to setup character Collisions? 2 Answers

Realistic collisions with a kinematic rigidbody? 1 Answer

is there a way to move a rigidbody with something like moveposition without clipping through collider? 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