绿色点是矢量p1,红色点是矢量p2。我可以使用p2.sub(p1).angle()
方法访问光线角度。
考虑:
float oberserverAngle = p2.cpy().sub(p1).angle();
RayCastCallback callback = new RayCastCallback() {
@Override
public float reportRayFixture(Fixture fixture, Vector2 point, Vector2 normal, float fraction) {
}
}
world.rayCast(callback, p1, p2);
现在,当我这样做时,FOV是不对的,我缺少什么?
shape.line(p1, p2)
Vector p3 = p2.cpy().setAngle(oberserverAngle * 0.5f);
Vector p4 = p2.cpy().setAngle(-oberserverAngle * 0.5f);
shape.line(p1, p3);
shape.line(p1, p4);