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

Weapon in Hand pushing Character because of Colliders

Discussion in 'Physics' started by HaUnity99, May 2, 2020.

  1. HaUnity99

    HaUnity99

    Joined:
    May 2, 2020
    Posts:
    3
    I am working on a VR game. My Character has two hands and can grab objects.

    When I grab a weapon and hit the hitbox of the character with it, the character gets pushed away.

    When I grab a weapon, the weapon becomes the child of the hand. I set the weapon's rigidbody to kinematic, but still collision is happening (I guess because the weapon colliders now take the player's rigidbody).

    I tried to set the weapon the a different layer that does not do any physics with the player. But for that, I will have to change the layer of all childs and childs of childs of that weapon. Colliders of the weapon are organized in many childs:

    upload_2020-5-2_19-16-5.png

    Is there anyway to prevent this behaviour?
     
  2. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    If you just set it to kinematic I don't think it "transfers" to the player rigidbody, try disabling the rigidbody completely (I think you can't set it active/unactive, but just remove the rigidbody and place it back when the weapon drops)
     
    HaUnity99 likes this.
  3. HaUnity99

    HaUnity99

    Joined:
    May 2, 2020
    Posts:
    3
    Thanks for your reply.

    I tried that in the past and it did not work.

    1. Remove Rigidbody: The weapon now takes the rigidbody of the character that holds the weapon
    2. Kinematic Rigidbody: Seems to be the same here
     
  4. HaUnity99

    HaUnity99

    Joined:
    May 2, 2020
    Posts:
    3
    Maybe there is an issue, regarding how I set up the GameObject structure?

    The Rigidbody is on the empty gameObject "pistol_03 (1)", bu eh colliders are under the different Transforms in "Mesh" (e.g. "Cube" and "Cube.001")