private static void DrawWireframeLightEdgeGizmo(World w, Entity e, float2 edgeDir, float2 source, float rotOffset) { var em = w.EntityManager; var ls = em.GetComponentData <LightSource>(e); var pos = em.GetComponentData <Position>(e); Gizmos.DrawRay((Vector2)pos.pos, (Vector2)Lin.Rotate(edgeDir, rotOffset) * 50); }
private static void DrawWireframeOpaqueEdgeGizmo(World w, Entity e, float2 source, float2 mount, float2 posOffset, float rotOffset) { var em = w.EntityManager; DrawWireframeBoxGizmo(w, e, posOffset, rotOffset); var box = em.GetComponentData <Box>(e); var pos = em.GetComponentData <Position>(e); mount = Lin.Rotate(mount - pos.pos, rotOffset) + pos.pos + posOffset; var dir = math.normalize(mount - source); Gizmos.DrawRay((Vector2)mount, (Vector2)dir * 50); }
public float2 GlobalToLocal(float2 point) { return(Lin.Rotate(point - pos, -rot)); }
public float2 LocalDirectionToGlobal(float2 direction) { return(Lin.Rotate(direction, rot)); }
public float2 LocalToGlobal(float2 point) { return(Lin.Rotate(point, rot) + pos); }