Beispiel #1
0
        public bool Grab(Body other)
        {
            if (!IsGrabbed(other) && GrabbedComponents.Count < MaxGrabs)
            {
                Matrix m = Matrix.Identity;
                m                     = GlobalTransform;
                m.Translation         = GlobalTransform.Translation + new Vector3(0, 0.0f, 0.5f);
                other.GlobalTransform = m;

                GrabbedItem item = new GrabbedItem
                {
                    Component      = other,
                    LocalTransform = Matrix.Invert(GlobalTransform) * other.GlobalTransform
                };

                GrabbedComponents.Add(item);

                other.LocalTransform = item.LocalTransform;
                AddChild(other);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
 private void HandleStartGrab()
 {
     GrabbedItem = GrabPreview.Grabbable;
     if (GrabPreview.WasThumbnail)
     {
         PreviewBox.StartThumbnailGrab();
         GrabbedItem.StartThumbGrab();
     }
     else
     {
         PreviewBox.StartGrab();
         GrabbedItem.StartGrab();
     }
 }
Beispiel #3
0
 private void HandleStopGrabbing()
 {
     PreviewBox.EndGrab();
     GrabbedItem.EndGrab();
     GrabbedItem = null;
 }
Beispiel #4
0
        public bool Grab(Body other)
        {
            if(!IsGrabbed(other) && GrabbedComponents.Count < MaxGrabs)
            {
                Matrix m = Matrix.Identity;
                m = GlobalTransform;
                m.Translation = GlobalTransform.Translation + new Vector3(0, 0.0f, 0.5f);
                other.GlobalTransform = m;

                GrabbedItem item = new GrabbedItem
                {
                    Component = other,
                    LocalTransform = Matrix.Invert(GlobalTransform) * other.GlobalTransform
                };

                GrabbedComponents.Add(item);

                other.LocalTransform = item.LocalTransform;
                AddChild(other);
                return true;
            }
            else
            {
                return false;
            }
        }