Beispiel #1
0
    public void zAxisSelected()
    {
        selectedAxis = SelectedAxis.zAxis;

        GetGraphPoints();

        graphCreator.CreateGraph();
    }
 public void OnMouseUp(object sender, MouseEventArgs e)
 {
     if (Hidden)
     {
         return;
     }
     if (e.Button == MouseButtons.Left)
     {
         selectedAxis = SelectedAxis.None;
     }
 }
Beispiel #3
0
        private Vector3 GetAxisPlaneHitPoint(SceneObject obj, Ray ray)
        {
            Vector3 planeDisplacement = (obj.Transform.Position * SelectedAxis.Abs());
            float   sign = planeDisplacement.IsZero() ? 1 : Math.Sign(planeDisplacement.X + planeDisplacement.Y + planeDisplacement.Z);
            Plane   p1   = new Plane(planeDisplacement.Length, sign * SelectedAxis);

            float dist;

            if (p1.IntersectsRay(ray, out dist))
            {
                return(ray.Origin + ray.Direction.Normalized() * dist);
            }

            return(Vector3.Zero);
        }
        public void OnMouseDown(object sender, MouseEventArgs e)
        {
            if (Hidden) return;
            var scene = sender as Form1;
            if (scene != null && e.Button == MouseButtons.Left)
            {
                var raycast = new BulletSharp.RaycastInfo();
                var callback = new BulletSharp.CollisionWorld.ClosestRayResultCallback(e.MouseRay.Origin, e.MouseRay.Origin + e.MouseRay.Direction * e.MouseRayFarPoint);
                var collisionWorld = scene.collisionWorld;
                collisionWorld.RayTest(e.MouseRay.Origin, e.MouseRay.Origin + e.MouseRay.Direction * e.MouseRayFarPoint, callback);

                if (callback.HasHit)
                {
                    if (callback.CollisionObject == rightContact)
                        this.selectedAxis = SelectedAxis.U;
                    else if (callback.CollisionObject == forwardContact)
                        this.selectedAxis = SelectedAxis.V;
                    else if (callback.CollisionObject == upContact)
                        this.selectedAxis = SelectedAxis.W;
                    else return;
                    worldRegistrationPosition = callback.HitPointWorld - this.position;
                }
            }
        }
 public void OnMouseUp(object sender, MouseEventArgs e)
 {
     if (Hidden) return;
     if (e.Button == MouseButtons.Left)
     {
         selectedAxis = SelectedAxis.None;
     }
 }