fix cones-of-sight tilting in the wrong up/down direction when facing left

GitOrigin-RevId: 6b4925c75f44069af84685bc749a3586ad376e1d
This commit is contained in:
Colin McMillen 2020-02-03 12:02:52 -05:00
parent 4758ce519b
commit d44ac76d49

View File

@ -182,10 +182,10 @@ namespace SemiColinGames {
float visionRangeSq = visionRange * visionRange; float visionRangeSq = visionRange * visionRange;
Vector2 ray = new Vector2(visionRange * (int) facing, 0); Vector2 ray = new Vector2(visionRange * (int) facing, 0);
if (pose == Pose.Stretching) { if (pose == Pose.Stretching) {
ray = Rotate(ray, FMath.DegToRad(-30)); ray = Rotate(ray, (int) facing * FMath.DegToRad(-30));
} }
if (pose == Pose.Crouching) { if (pose == Pose.Crouching) {
ray = Rotate(ray, FMath.DegToRad(30)); ray = Rotate(ray, (int) facing * FMath.DegToRad(30));
} }
Vector2 coneBottom = Rotate(ray, fov); Vector2 coneBottom = Rotate(ray, fov);
Vector2 coneTop = Rotate(ray, -fov); Vector2 coneTop = Rotate(ray, -fov);