private void DragHandle() { model.dragPosition = GetWorldPosition(Input.mousePosition); if (Input.GetMouseButtonDown(0)) { dragInfo = Collision.GetClosestVertex(world, model.dragPosition); if (dragInfo.body != null) { model.draggedBody = dragInfo.body; dragConstraint.Activate(dragInfo); } } else if (Input.GetMouseButton(0) && model.draggedBody != null) { dragConstraint.dragPosition = model.dragPosition; } else if (Input.GetMouseButtonUp(0) && model.draggedBody != null) { model.draggedBody = null; model.draggedVertex = null; dragConstraint.Deactivate(); } else { model.draggedVertex = Collision.GetClosestVertex(world, model.dragPosition).v; } }
public void Deactivate() { info = new Collision.ClosestInfo(); }
public void Activate(Collision.ClosestInfo info) { this.info = info; }