I am assuming that the wall continues infinitely (is a plane), even though the wall actually has a start and stop point.
I know:
A
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.
//wallPlane.D=wallPoint1.
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;
}

New Topic/Question
Reply


MultiQuote


|