Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Gameobject joined to rigidbody without rigidbodys interaction.

Discussion in 'Physics' started by franek327327, May 26, 2020.

  1. franek327327

    franek327327

    Joined:
    May 26, 2020
    Posts:
    2
    At first sorry for my bad english...
    I have gameobject which is joined to my player's rigidbody and what should I do to gameobject's rigidbody not interact with player's rigidbody when I want to have rigidbody component on both gameobjects?
     
  2. hessex

    hessex

    Joined:
    Jul 24, 2019
    Posts:
    7
    You'll want to use "Layers" to determine which Game Objects should interact physically. Once you have assigned each of these Game Objects to a layer you can enable/disable the collisions of those objects in Project Settings > Physics.

    More information here: https://docs.unity3d.com/Manual/LayerBasedCollision.html
     
  3. franek327327

    franek327327

    Joined:
    May 26, 2020
    Posts:
    2
    That isn't working. I mean that if i change mass of the gameobject then that mass will not interact with my player.
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,623
    What you're saying doesn't make sense. I would try to be more specific. Firstly, you're not stating whether you're using 2D or 3D physics which is very important. Secondly, a GameObject has no concept of Mass so you're saying that you change the Rigidbody or Rigidbody2D mass but this has nothing to do with what you asked and doesn't change whether Rigidbody(2D) interact.

    Finally I would state clearly what you mean by "interact". Presumably you mean that they collide and have a collision response? Also, what do you mean by "joined"? Using a Joint? Again, your words are being vague. Try to be specific about what you want.

    Whether two Rigidbody(2D) & attached Collider(2D) collide is indeed set-up using the Layer Collision Matrix as posted above. Go to the Project Settings and set the Layer Collision Matrix for the Layers you're both set-up and assign the the GameObject in question. Note that there are separate project settings and therefore collision matrix for 2D and 3D.

    You can stop them colliding there. Note that if you are indeed using Joints then joints have their own override on whether jointed (joined) Rigidbody(2D) can collide. Again, this is slightly different if you're using 2D or 3D joints.