0 Replies - 3077 Views - Last Post: 21 September 2012 - 06:12 PM

#1 rex64  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 171
  • Joined: 31-January 12

Convert Two Vector3 to Plane then find point where Ray intersects

Posted 21 September 2012 - 06:12 PM

I would like to convert Two Vector3 to Plane then find the point where ray intersects. I am looking for C, so that I can calculate the reflected velocity in the diagram. The reflected velocity Let me know if you see an easier way?

I am assuming that the wall continues infinitely (is a plane), even though the wall actually has a start and stop point.

I know:
Ships direction of travel (velocity)
Wall Point 1
Wall Point 2

I can easily find:
B (but my method may be slow)

        public Vector3 getCollisionPointOnWall(Vector3 shipPointCenter, Vector3 shipVelocityAngle, Vector3 wallPoint1, Vector3 wallPoint2)
            Vector3 pointOnWall = Vector3.Zero;

            Plane wallPlane;
            //wallPlane.Normal = Vector3.Normalize(wallPoint1);  //this will not be perpinducluar, we need to find a poitn on the plane that is perpinduclar.
            return pointOnWall;

        /// <summary>
        /// Finds the point (vector3) where the ray intersects the plane.
        /// </summary>
        Vector3 GetRayPlaneIntersectionPoint(Ray ray, Plane plane)
            float? distance = ray.Intersects(plane);
            return distance.HasValue ? ray.Position + ray.Direction * distance.Value : Vector3.Zero;

Attached image(s)

  • Attached Image

Is This A Good Question/Topic? 0
  • +

Page 1 of 1