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 Wachronos · Mar 18, 2016 at 12:49 PM · collisioninstantiaterandom

Instantiated objects ignoring collisions randomnly o.O

Hi guys!

I'm a bit lost here, I'm instantiating objects that are supposed to fall and hit the top of a cube. I have 4 prefabs that I instantiate randomnly at random positions above the cube. Then they fall and some of them hit the cube and stay there... some others just cross the cube... and ignore all collisions... I have no idea what this is happening... Do you have any idea?

I'm just instantiating using the usual initialization

 GameObject newInst = GameObject.Instantiate(objctList[selectedIdx]);
 newInst .transform.position = position;
 ....

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Raresh · Mar 20, 2016 at 09:57 PM

It happened to me once when I started and wanted to make a cup thing that can hold spheres. The reason I think it is is that once the objects move fast enough, the physics engine doesn't detect any collisions because they pass through each other(because of the speed). I can think of 2 ways of solving this:

1) If the object they are falling on is a ground static type, make it a cube, and make it thicker so that it can detect the collision better

2) Make a raycast from the moving object to the target, once the raycast doesn't return that it hit the target, it means it passed it and should've stopped (if you keep the previous position you can teleport it back to the last known position)

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 Wachronos · Mar 22, 2016 at 04:39 PM 0
Share

mmmm it makes sense.... shouldn't happen, but it makes sense if that is the case. Thanks for the reply!

Initially the ground was already an object of the type cube and it was still allowing objects to pass through... I ended fixing the problem in another way... created another cube that is just slightly below the first "ground"...With both cubes, apparently most of the objects already stay in the "correct" place, i.e. on top of either cubes... I don't particularly like the solution, but it's one way to fix the problem. This way I could avoid the second solution :)

avatar image
0

Answer by Rob2309 · Mar 23, 2016 at 11:02 AM

If your falling cubes have RigidBody attached to them, you can just change the Collision Detection from Discrete to Continuous... This should fix your problem as long as the floor they are falling towards does not move :)

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

Instantiate random object from Array 2 Answers

Overlapping Prefabs 0 Answers

Need help instantiating enemies between random locations 1 Answer

How can I Instantiate and do it in a random spot in a random spot? 2 Answers

Instantiate random prefab ONCE 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