private Vector3 GetCollisionPoint(BzKnife knife) { Vector3 distToObject = transform.position - knife.Origin; Vector3 proj = Vector3.Project(distToObject, knife.BladeDirection); Vector3 collisionPoint = knife.Origin + proj; return(collisionPoint); }
private IEnumerator Slice(BzKnife knife) { // The call from OnTriggerEnter, so some object positions are wrong. // We have to wait for next frame to work with correct values yield return(null); Vector3 point = GetCollisionPoint(knife); Vector3 normal = Vector3.Cross(knife.MoveDirection, knife.BladeDirection); Plane plane = new Plane(normal, point); if (_sliceableAsync != null) { _sliceableAsync.Slice(plane, knife.SliceID, null); } }