Hey guys,
Im using Ashley and LibGDX to make a top-down game, but i wanted to use my own “physics engine”.
In my previous projects i always integrated Box2DLights for lighting, but since it uses Box2D to do the math, i had a problem.
So i downloaded the sources of Box2DLights and changed it to use Entities instead of Bodies.
Everything is working fine, except the shadows. I cant get raycasting to work.
TL;DR Teach me how 2 raycast pls (or point me in the right direction)
Additional info:
-2D Environment
-Each entity has a Position and CollisionBox component.
-CollisionBox has 2 fields : size and offset
-Engine object manages enities. You can get any entity or group you want at any given time
-The function that gets called for raycasting:
public static void rayCast(Engine engine, RayCastCallback ray, Vector2 start, Vector2 tmpEnd){
//TODO: Implement raycasting
}
-What it should do in the end:
ray.reportRayFixture(Entity body, Vector2 point, Vector2 normal, float fraction);