Okej, here i am trying with this own method. I want to get the hit position between their two points:
SimleVector hited = GetRayHitPosition(turretPosition, camPosition);
public SimpleVector GetRayHitPosition(SimpleVector point1, SimpleVector point2)
{
float viewDistance = Functions.computeAverageDistance(point1, point2);
SimpleVector dir = new SimpleVector();
dir.add(point2);
dir.sub(point1);
float aimToPlayer = RenderEngine.ThisWorld.calcMinDistance(point1, dir, viewDistance);
SimpleVector result = new SimpleVector();
result.add(point1);
dir.x = dir.x / 1 * aimToPlayer;
dir.y = dir.y / 1 * aimToPlayer;
dir.z = dir.z / 1 * aimToPlayer;
result.add(dir);
return result;
}
But it dont work very well, it is hard to explain what the wrong is. Maybe there is somehere who can help me with the code, so i can get the hit position?