Refactor: separate buffer indexing and swizzling.

This also fixes a sensor data reading bug: previously, _sensorIndex was multiplied by 3 by MjEngineTool.

PiperOrigin-RevId: 451699887
Change-Id: I864bcbf8159857764854b25311a26ec5672125d9
This commit is contained in:
Tom Erez
2022-05-29 00:23:57 -07:00
committed by Copybara-Service
parent 5cc73c30bf
commit 02f300c762
16 changed files with 213 additions and 86 deletions
+2 -1
View File
@@ -159,7 +159,8 @@ namespace Mujoco {
MujocoLib.mj_objectVelocity(
scene.Model, scene.Data, (int)MujocoLib.mjtObj.mjOBJ_BODY, body.MujocoId, res, 0);
// linear velocity is in the last 3 entries
bodyVel = MjEngineTool.UnityVector3(res, 1);
bodyVel = MjEngineTool.UnityVector3(
MjEngineTool.MjVector3AtEntry(res, 1));
}
float springStiffness = 100;