It doesn't matter where the car starts from. Wherever the car intercepts the circle, the distance between the car and the centre of the circle is the radius. To get the point of intersection all you then need is the angle between the centre of the circle and the car's position.
So, function for getting the angle between 2 points (in radians):
So to get the point of interception:Code:function getAngle(x:Number, x2:Number, y:Number, y2:Number):Number { return Math.atan2(y-y2, x-x2); }
Obviously put your own variables in there.Code:var a:Number = getAngle(car._x, circleCentreX, car._y, circleCentreY); var x:Number = Math.cos(a) * radius + circleCentreX; var y:Number = Math.sin(a) * radius + circleCentreY;




Reply With Quote
