Set max in hill climbing support. When imax is the optimal index then this reduces from three iterations down to one.

PiperOrigin-RevId: 948334160
Change-Id: Ia12fbc853fc65f70c525a617cfdced6e98d30dca
This commit is contained in:
Kyle Bayes
2026-07-15 07:50:16 -07:00
committed by Copybara-Service
parent 52317058ba
commit 06f12a9372
+1 -1
View File
@@ -406,9 +406,9 @@ static void mjc_hillclimbSupport(mjtNum res[3], mjCCDObj* obj, const mjtNum dir[
mjtNum local_dir[3];
mulMatTVec3(local_dir, mat, dir);
mjtNum max = -FLT_MAX;
int prev = -1;
int imax = obj->meshindex >= 0 ? obj->meshindex : 0;
mjtNum max = dot3f(local_dir, verts + 3*vert_globalid[imax]);
// hillclimb until no change
while (imax != prev) {