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 /
  • Help Room /
avatar image
2
Question by Neran28 · Nov 14, 2018 at 01:47 PM · collisionrigidbodycontrollerbest practices

How to make objects block each other without being affected by physics interactions

I am writing a custom character controller and encountered a problem with rigidbodies that confuses me. First let me explain what im trying to achieve:


  • Its a third person multiplayer game (one screen)

  • There are basically 4 types of objects:
    • Player characters (moving)

    • Enemies (moving)

    • Objects that can be picked up by the player (they move with the player when picked up)

    • static objects (world)

  • Each of those objects should block each other.

  • There should be no further physics interactions between those objects except some sort of gravity.


So if a player/enemy tries to move against another player/enemy/pickup object he is blocked by that. Same for any other of these combinations. Now it is highly suggested by UT to use rigidbody on any objects that move and have a collider. For me this means the first three kind of objects mentioned above. At first this works well, collisions are detected and there is also gravity. But the problem is that every rigidbody object can push other rigidbodies because of physics interactions. And i do not want this. As far as i undestood you should mark your object kinematic if you do not want them to be influenced by physics but still want those objects treated as non-static colliders. So I marked the enemies as kinematic but this does not help a lot since they still push players and pickups around. So i marked everything kinematic. Now i do not have any collisions at all, there is not even an event triggered. Its like not using rigidbodies at all. It looks like you need dynamic rigidbodies to detect collisions anyway. Dont really undestand why to use kinematic if you want them to be treated as non-static colliders but they wont detect collisions with each other or static colliders anyway. So its useful to use kinematic only in conjunction with dynamic rigidbodies? Is there actually a case you want to be the player or an enemy kinematic at all since they can no longer interact with static colliders?

However. Using constraints instead of kinematic is somewhat half working. The objects wont block each other but they will at least trigger collisions. But they wont be able to move using rb.movePosition. And using transform to move rb objects is also considered a no no.


I really do not know what the default approach is supposed to be in unity for this kind of problem if you are supposed to use RBs for moving objects but dont want them to be influenced by the physics engine except preventing them to move through each other. This does not look like an uncommon case. I mean there a plenty of games that dont have real physics interactions but some kind of colliders that cannot overlap. Lets take a platformer or jump n run as an example if the player character is a kinetic rb he wont be able to detect collisions with static colliders (world). But if it is not kinematic its rotation / position may be influenced by other RBs (enemies) which may be unwanted.

Appreciate any tips and explanations.

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

0 Replies

· Add your reply
  • Sort: 

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

234 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

why my object pass through 0 Answers

Why does the player hover over the ground instead of touching it? Why doesn't it always jump when I press space? 2 Answers

Adding collisions to a custom character controller? 1 Answer

My character doesn't detect collisions or Hinge joint. 0 Answers

Parented Game object with collider not colliding 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