开发者

AS3: angle of reflection

开发者 https://www.devze.com 2023-04-10 05:46 出处:网络
I am stumped on working out the angle of reflection in my AS3 project, I have the formula but the formula relies on you knowing the angle of the object that is reflected against (to work out the perpe

I am stumped on working out the angle of reflection in my AS3 project, I have the formula but the formula relies on you knowing the angle of the object that is reflected against (to work out the perpendicular angle) the trouble is the objects are all at 0 rotation but are shaped differently (e.g the four sides of the stage have a line across them which is at 0 rotation but some are horizontal and some vertical).

How would I work out the angle of reflection purely from开发者_如何学编程 the angle of the object that is being reflected, taking into account AS3 returns rotation values between -180 and 180.

Anyone got an idea?


This doesn't answer my question so much as it only works on objects reflecting of horizontal or vertical objects but this function will get you the angle of reflection based upon the rotation of the object which is being reflected...

var reflection:int = (incidence > 0) ? 180 - incidence: -180 - incidence;

where incidence which is the rotation of the object which is being reflected.

0

精彩评论

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

关注公众号