protected virtual void UpdateConstraint() { if (space != null) { space._Remove(this); } CP.ConstraintSetBodies(_handle, handleA, handleB); if (space != null) { space._Add(this); } CP._cpConstraintSetMaxForce(_handle, _maxForce); CP._cpConstraintSetErrorBias(_handle, _errorBias); CP._cpConstraintSetMaxBias(_handle, _maxBias); }
protected void OnEnable() { if (_handle == IntPtr.Zero) { Debug.LogError("ChipmunkConstraint handle is not set."); return; } bodyA = this.GetComponentUpwards <ChipmunkBody>(); CP.ConstraintSetBodies(_handle, handleA, handleB); UpdateConstraint(); // add to space: space = Chipmunk.manager._space; space._Add(this); }