Wat am i doing wrong?
Thanks in advance
Here is my code snippet
Code: Select all
public ModelMesh leftRailings;
if (mesh.Name == "Railing_L") {
leftRailings = mesh;
//System.Windows.Forms.MessageBox.Show("true");
}
Desertmap c = (Desertmap)newTrack;
currentCar.checkRayIntersection(c.leftRailings);
public bool checkRayIntersection(ModelMesh sphere) {
if (sphere != null) {
Ray front = new Ray(Vehicle.Body.Position, Vector3.Right);
float? distance = front.Intersects(sphere.BoundingSphere);
if (distance < 5)
{
System.Windows.Forms.MessageBox.Show("true" + distance.ToString() + sphere.BoundingSphere.Radius.ToString() );
return true;
}
}
return false;
}