protected void AddCollider() { Component unityCollider = GetUnityCollider(ref wasUnityColliderEnabled); if (unityCollider != null) { // register the collider: idToCollider[unityCollider.GetInstanceID()] = unityCollider; CreateTracker(); oniCollider = Oni.CreateCollider(); if (tracker != null) { Oni.SetColliderShape(oniCollider, tracker.OniShape); } // Send initial collider data: UpdateAdaptor(); // Update collider material: UpdateMaterial(); // Create rigidbody if necessary, and link ourselves to it: CreateRigidbody(); // Subscribe collider callback: ObiSolver.OnUpdateColliders += UpdateIfNeeded; ObiSolver.OnAfterUpdateColliders += ResetTransformChanges; } }
protected virtual void Awake() { wasUnityColliderEnabled = IsUnityColliderEnabled(); // register the collider: idToCollider.Add(unityCollider.GetInstanceID(), unityCollider); CreateTracker(); oniCollider = Oni.CreateCollider(); FindSolvers(false); if (tracker != null) { Oni.SetColliderShape(oniCollider, tracker.OniShape); } // Send initial collider data: UpdateColliderAdaptor(); Oni.UpdateCollider(oniCollider, ref adaptor); // Update collider material: UpdateMaterial(); // Create rigidbody if necessary, and link ourselves to it: CreateRigidbody(); // Subscribe collider callback: ObiSolver.OnUpdateColliders += UpdateIfNeeded; }
protected void AddCollider() { Component unityCollider = GetUnityCollider(ref wasUnityColliderEnabled); if (unityCollider != null && oniCollider == IntPtr.Zero) { // register the collider: idToCollider[unityCollider.GetInstanceID()] = unityCollider; oniCollider = Oni.CreateCollider(); CreateTracker(); // Send initial collider data: UpdateAdaptor(); // Update collider material: UpdateMaterial(); // Create rigidbody if necessary, and link ourselves to it: CreateRigidbody(); // Subscribe collider callback: ObiColliderBase.OnUpdateColliders += UpdateIfNeeded; ObiColliderBase.OnResetColliderTransforms += ResetTransformChangeFlag; } }
protected virtual void Awake() { wasUnityColliderEnabled = IsUnityColliderEnabled(); // register the collider: idToCollider.Add(unityCollider.GetInstanceID(), unityCollider); CreateTracker(); oniCollider = Oni.CreateCollider(); FindSolvers(false); if (tracker != null) { Oni.SetColliderShape(oniCollider, tracker.OniShape); } // Send initial collider data: UpdateColliderAdaptor(); Oni.UpdateCollider(oniCollider, ref adaptor); // Update collider material: if (material != null) { Oni.SetColliderMaterial(oniCollider, material.OniCollisionMaterial); } else { Oni.SetColliderMaterial(oniCollider, IntPtr.Zero); } // Create rigidbody if necessary, and link ourselves to it: CreateRigidbody(); // Subscribe collider and rigidbody update callbacks: ObiArbiter.OnStepStart += UpdateIfNeeded; ObiArbiter.OnStepEnd += UpdateRigidbody; }