layer changes, camera added
This commit is contained in:
@@ -74,9 +74,11 @@ public class MocapControllerArtanim : MonoBehaviour, IOnSensorCollision
|
||||
|
||||
bool _hasLazyInitialized;
|
||||
|
||||
private List<GameObject> allChildObjects = new List<GameObject>();
|
||||
|
||||
|
||||
void SetOffsetSourcePose2RBInProceduralWorld() {
|
||||
|
||||
void SetOffsetSourcePose2RBInProceduralWorld() {
|
||||
|
||||
_transforms = GetComponentsInChildren<Transform>().ToList();
|
||||
|
||||
@@ -339,19 +341,17 @@ public class MocapControllerArtanim : MonoBehaviour, IOnSensorCollision
|
||||
// set the layers
|
||||
ragdollForMocap.layer = this.gameObject.layer;
|
||||
|
||||
FindAllChildObjects(ragdollForMocap.transform);
|
||||
|
||||
|
||||
|
||||
foreach (Transform child in ragdollForMocap.transform)
|
||||
foreach (var obj in allChildObjects)
|
||||
{
|
||||
child.gameObject.layer = this.gameObject.layer;
|
||||
obj.layer = this.gameObject.layer;
|
||||
}
|
||||
|
||||
// setup HandleOverlap
|
||||
foreach (var rb in clone.GetComponentsInChildren<Rigidbody>())
|
||||
{
|
||||
// remove cloned HandledOverlap
|
||||
Transform t = rb.GetComponent<Transform>();
|
||||
t.gameObject.layer = 3;
|
||||
var oldHandleOverlap = rb.GetComponent<HandleOverlap>();
|
||||
DestroyImmediate(oldHandleOverlap);
|
||||
var handleOverlap = rb.gameObject.AddComponent<HandleOverlap>();
|
||||
@@ -368,7 +368,20 @@ public class MocapControllerArtanim : MonoBehaviour, IOnSensorCollision
|
||||
//Debug.Log(children.Count);
|
||||
|
||||
}
|
||||
void SetupSensors()
|
||||
|
||||
// Function to recursively find all child game objects
|
||||
private void FindAllChildObjects(Transform parent)
|
||||
{
|
||||
foreach (Transform child in parent)
|
||||
{
|
||||
// Add the child to the list
|
||||
allChildObjects.Add(child.gameObject);
|
||||
|
||||
// Recursively call this function for each child's children
|
||||
FindAllChildObjects(child);
|
||||
}
|
||||
}
|
||||
void SetupSensors()
|
||||
{
|
||||
_sensors = GetComponentsInChildren<SensorBehavior>()
|
||||
.Select(x=>x.gameObject)
|
||||
|
||||
Reference in New Issue
Block a user