diff --git a/pufferlib/ocean/drive/drive.h b/pufferlib/ocean/drive/drive.h index 7203b583b..5995c7ff2 100644 --- a/pufferlib/ocean/drive/drive.h +++ b/pufferlib/ocean/drive/drive.h @@ -2352,7 +2352,8 @@ void draw_agent_obs(Drive* env, int agent_index, int mode, int obs_only, int las return; } - int max_obs = 10 + 7*(MAX_AGENTS - 1) + 7*MAX_ROAD_SEGMENT_OBSERVATIONS; + int ego_dim = (env->dynamics_model == JERK) ? 10 : 7; + int max_obs = ego_dim + 7*(MAX_AGENTS - 1) + 7*MAX_ROAD_SEGMENT_OBSERVATIONS; float (*observations)[max_obs] = (float(*)[max_obs])env->observations; float* agent_obs = &observations[agent_index][0]; // self @@ -2376,7 +2377,7 @@ void draw_agent_obs(Drive* env, int agent_index, int mode, int obs_only, int las DrawCircle3D((Vector3){goal_x_world, goal_y_world, 0.1f}, env->goal_radius, (Vector3){0, 0, 1}, 90.0f, Fade(LIGHTGREEN, 0.3f)); } // First draw other agent observations - int obs_idx = 10; // Start after ego obs + int obs_idx = ego_dim; // Start after ego obs for(int j = 0; j < MAX_AGENTS - 1; j++) { if(agent_obs[obs_idx] == 0 || agent_obs[obs_idx + 1] == 0) { obs_idx += 7; // Move to next agent observation