开发者

Get length of opposite from adjacent and angle

开发者 https://www.devze.com 2023-03-21 03:24 出处:网络
Im trying to determine where a \"shot\" will hit the wall from a position and an angle. The player shoots a ball from a certain point with a certain angle towards a wall. And I want to be able to dete

Im trying to determine where a "shot" will hit the wall from a position and an angle. The player shoots a ball from a certain point with a certain angle towards a wall. And I want to be able to determine if the ball will hit within the bounds of the goal.

This is what i know:

origin: the ball's coordinates

length: the distance to the wall

angle: the angle of the shot

This is what i want to calculate:

point: the position the ball will have when it hits the wall

Get length of opposite from adjacent and angle

Thanks in开发者_如何学运维 advance!


unless i'm missing something:

point y = origin y + length
point x = origin x - length * tan(angle)


in Trig for a right angled triangle Tan(angle) = opposite/adjacent.

This should be all you need to get your position.

It should be noted that this is not a programming question as such and there are probably other places for Maths questions like this. :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号