public FixedLinearSpringVisual AddFixedLinearSpringVisualToCanvas(FixedLinearSpring spring) { FixedLinearSpringVisual visual = new FixedLinearSpringVisual(); if (spring != null) { new FixedLinearSpringVisualHelper(visual, spring); } AddVisualToCanvas(visual, null); return(visual); }
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) { base.OnMouseLeftButtonDown(e); Vector2 point = new Vector2((float)(e.GetPosition(this).X), (float)(e.GetPosition(this).Y)); pickedGeom = physicsSimulator.Collide(point); if (pickedGeom != null) { mousePickSpring = SpringFactory.Instance.CreateFixedLinearSpring(physicsSimulator, pickedGeom.Body, pickedGeom.Body.GetLocalPosition( point), point, 20, 10); mouseSpringVisual = AddFixedLinearSpringVisualToCanvas(mousePickSpring); } }