Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 aneeshjose · Jul 03, 2018 at 09:28 AM · collidergravity

How to stop a 3d object

How to stop a 3D object(say a car) falling downwards when collided with another 3d object(say a road). I have tried this the whole day but no results.

Comment
Add comment · Show 2
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 Harinezumi · Jul 03, 2018 at 04:00 PM 0
Share

$$anonymous$$oving objects need a rigidbody, and one or more colliders that approximate its shape. Static objects (things that won't move, like the ground or the road) only need a collider (and it's better if you mark the whole game object static). With this setup, collisions work normally.
One thing that you need to be aware of is you can't use BoxColliders on planes with 0 height, it just doesn't work. You either have to use a $$anonymous$$eshCollider or give the BoxCollider a non-zero size (preferably at least 1 unit).

avatar image RatMoleRat · Jul 03, 2018 at 09:05 PM 0
Share

Are the colliders on the objects both mesh colliders? Two mesh colliders won't collide unless one is marked as convex.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by swanne · Jul 03, 2018 at 09:47 AM

Unity Physics will control this for you. All you need to do is make sure that a rigidbody component and collider component are present on the car. Make sure that the collider is not set to trigger. Then also add a collider to the road gameObject, making sure that it is not a trigger.

It's always good practice to Proof of Concept things you're not too sure about. Create a new 3D object of plane and add a collider to it, if one does not aready exist. Then create a 3D object of cube and place it above the plane. Add a collider component to it and a rigidbody component. Press play and watch the cube fall onto the road.

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 aneeshjose · Jul 03, 2018 at 10:07 AM 0
Share

The car is made up of so many things line tires,body,etc. The road is made up of grass(top plane) and mud (bottom plane). All the components of car and road are placed under two game objects named CAR and ROAD . I placed Rigidbody with gravity for the car with a box collider and IsTrigger is unchecked. Also Road have RigidBody with no gravity , added Box Collider with IsTrigger unchecked. But it is not working.

I have created a test scene as you suggested and it works perfectly. But it is not working with the car and the road.

avatar image swanne aneeshjose · Jul 03, 2018 at 03:34 PM 0
Share

Do any of the other components of the car have colliders or is it just the parent object of CAR which has a collider? Same questions for the 2 layers in the ROAD object. Also, the road doesnt need a RigidBody on it. If you are able to zip your project up and send it to me, i'll be happy to have a look for you.

avatar image
0

Answer by MPHYS · Jul 03, 2018 at 10:05 PM

If you want it to simply freeze on the spot try destroying the Rigidbody.

 Destroy(youGameObject.GetComponent<Rigidbody>());
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

113 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 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 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 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 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 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

Object floating and going through walls/ground. 1 Answer

Rigidbodies getting stuck in non moving objects 0 Answers

Collision in between 2 objects moving away from each other? 1 Answer

Physics dont take place until animation is done? 0 Answers

Check if Rigidbody collider is grounded 3 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