only draw collider line for circles

This commit is contained in:
jacob 2024-10-10 13:24:08 -05:00
parent 59361a60af
commit c193e31cce
2 changed files with 4 additions and 5 deletions

View File

@ -1054,11 +1054,11 @@ INTERNAL void game_update(struct game_cmd_array game_cmds)
#if 1 #if 1
if (entity_has_prop(ent, ENTITY_PROP_PLAYER_CONTROLLED)) { if (entity_has_prop(ent, ENTITY_PROP_PLAYER_CONTROLLED)) {
//if ((true)) { //if ((true)) {
#if 1 #if 0
ent->local_collider.points[0] = V2(0, 0); ent->local_collider.points[0] = V2(0, 0);
ent->local_collider.count = 1; ent->local_collider.count = 1;
ent->local_collider.radius = 0.5; ent->local_collider.radius = 0.5;
#elif 0 #elif 1
ent->local_collider.points[0] = V2(0, 0.5); ent->local_collider.points[0] = V2(0, 0.5);
ent->local_collider.points[1] = V2(0, -0.5); ent->local_collider.points[1] = V2(0, -0.5);
ent->local_collider.count = 2; ent->local_collider.count = 2;

View File

@ -1001,13 +1001,12 @@ INTERNAL void user_update(void)
//u32 detail = 32; //u32 detail = 32;
u32 detail = 512; u32 detail = 512;
draw_solid_collider_line(G.viewport_canvas, G.world_view, collider, xf, thickness, color, detail); draw_solid_collider_line(G.viewport_canvas, G.world_view, collider, xf, thickness, color, detail);
{ if (collider.count == 1 && collider.radius > 0) {
/* Draw upwards line for circle */
struct v2 start = xf.og; struct v2 start = xf.og;
struct v2 end = collider_support_point(&collider, xf, v2_neg(xf.by)); struct v2 end = collider_support_point(&collider, xf, v2_neg(xf.by));
start = xform_mul_v2(G.world_view, start); start = xform_mul_v2(G.world_view, start);
end = xform_mul_v2(G.world_view, end); end = xform_mul_v2(G.world_view, end);
/* Draw upwards line */
draw_solid_line(G.viewport_canvas, start, end, thickness, color); draw_solid_line(G.viewport_canvas, start, end, thickness, color);
} }
} }