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 hgaur725 · Dec 02, 2014 at 12:34 PM · rigidbodyoverlapping

How can i stop animals in may game overlap each other??

hey Folks, i know this has been asked previously but none of them helped me to sort out.. i have animals in my game on them i had rigidbody character controller and box collider too. but when they chase player they gets overlapp each other. i want them to stay way from each other. help thanks in advance..

Comment
Add comment · Show 9
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 HarshadK · Dec 02, 2014 at 07:34 AM 0
Share

Is your box collider a trigger?

avatar image hgaur725 · Dec 02, 2014 at 08:27 AM 0
Share

@Harshadk yes

avatar image SaraCecilia · Dec 02, 2014 at 02:29 PM 0
Share

Hey, @hgaur725, did @Harshad$$anonymous$$ help you solve your question? If so, can you accept his comment as a valid answer and close this thread?

avatar image GrKl · Dec 03, 2014 at 12:11 PM 0
Share

How do you move your animals? Show the script. From what I understand, that's where you will have a problem. Do you really need rigid body on them? character controller + simple collider should be enough. Depending on the needs of course

avatar image hgaur725 · Dec 03, 2014 at 12:17 PM 0
Share

@Gr$$anonymous$$l its quite large code and i am using character controller and simple box collider

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by HarshadK · Dec 02, 2014 at 12:30 PM

Then don't make it a trigger as rigidbodies can pass through trigger. Uncheck the Is Trigger checkbox and you're good to go.

Comment
Add comment · Show 3 · 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 Owen-Reynolds · Dec 02, 2014 at 05:08 PM 1
Share

But then they get stuck, grinding against each other. At best, you get one animal drifting sideways, sliding it's nose from shoulder to tail of another animal.

Better "avoidance" AI is the only thing I've found that works, but that's hard to write, and very specific.

What might kind of work is having small upright cylinder colliders. Would prevent them from the worst overlaps, and give an even slide-off for all by head-on collisions.

avatar image hgaur725 · Dec 03, 2014 at 05:08 AM 0
Share

@saracecilia no this is not solved And @Harshadk when i does that the animals starts flying and that weird.. is there is any scripting ref or ideas???

avatar image HarshadK · Dec 03, 2014 at 05:44 AM 0
Share

@hgaur The animals might be flying because some external force is applied on them. Try increasing their mass.

Also try the method stated by @owen-reynolds in his comment.

avatar image
0

Answer by screenname_taken · Dec 03, 2014 at 12:18 PM

The way i did it in mine is really crude, but for my case it helped. I assigned each animal an integer, and that integer showed its order in importance if you like. Then i made a function for OnTriggerEnter, to check that integer on the collider that entered that trigger. If the incoming trigger is of higher value than its own, then it has to give way. Basically reduce its movement speed or turn around. It doesn't work for a lot of animals together, but for a couple it helps. Perhaps you'll get some ideas out of this, like changing it to work with raycasting so that the enemy will know from advance that it needs to go around.

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

in Unity 2D game ,When i throw RigidBody 2D from up and it falls down sometime it overlap with other object ? 1 Answer

Checking if object intersects? 1 Answer

Not all sides of a cube collide properly( with pic) 2 Answers

Rigidbodies not working correctly 1 Answer

rigidbody.velocity.normalized application 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