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’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Question Instantiated Object not following Physics Matrix.

Discussion in 'Physics' started by Kurteth, May 20, 2023.

  1. Kurteth


    Aug 7, 2018
    Not sure what I'm doing wrong here. Forgive me for I'm a bit of newbie. I have a prefab that when I drag and drop it into the scene the collision matrix works fine. I have currently set it on a layer labeled TransparentFX and have (for testing purposes) removed all collision with every layer.

    However, when I instantiate the object, it ignores the physics matrix and instead collides with every single layer, regardless of what is checked or unchecked. I have checked the layers on the instantiated object, and although they are children of a skinned mesh renderer, their layer and tag is still the correct one.

    Here's the code.
    Code (CSharp):
    1. Vector3 position = AVG(edge.vertices);
    2.                 Vector3 normal = AVG(edge.normals).normalized;
    3.                 var rotation = Quaternion.FromToRotation(_prefabDirection, normal);
    5.                 var m = skinnedRenderer.sharedMesh.bindposes[maxIndex];
    6.                 position = m.MultiplyPoint3x4(position);
    8.                 blood = Instantiate(_bloodPrefab, bone);
    9.                 blood.transform.localPosition = position;
    10.                 blood.transform.localRotation = rotation;
    And here's the physics matrix proof.
    Last edited: May 20, 2023