My question is more math orientated than programing, regardless its something i drastically need help with.
Im making a soccer script, and i'm having a small issue that i just cant work out. Its sort of hard to explain so i made a picture to help me out:
Basically, when a player kicks the ball (the distance is the radius of the circle), i check to see if where the ball would have landed is inside of my area. If it is, i simply move the ball there; however if its not, i WANT to move it only to the circumference of the circle (this is to simulate collision detection) and bounce it back in to our soccer field (bouncing is done, dont worry about that lol).
Is there anyway to do this with: Player coordinates; Player's facing angle; Area center coordinates; Area radius; and the coord's where the ball WOULD'VE landed ? Keep in mind this isnt for C(++), its for a single threaded programing language (Doing the "collision detection" like this is to eliminate the need for a timer).
Trigonometry functions available:
Code: Select all
/*
Angle modes:
radians,
degrees (proffered),
grades
*/
native Float:floatsin(Float:value, anglemode:mode=radian);
native Float:floatcos(Float:value, anglemode:mode=radian);
native Float:floattan(Float:value, anglemode:mode=radian);