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:
committed by
Copybara-Service
parent
5cc73c30bf
commit
02f300c762
@@ -35,8 +35,10 @@ namespace Mujoco {
|
||||
}
|
||||
|
||||
public override unsafe void OnSyncState(MujocoLib.mjData_* data) {
|
||||
transform.position = MjEngineTool.UnityVector3(data->xpos, MujocoId);
|
||||
transform.rotation = MjEngineTool.UnityQuaternion(data->xquat, MujocoId);
|
||||
transform.position = MjEngineTool.UnityVector3(
|
||||
MjEngineTool.MjVector3AtEntry(data->xpos, MujocoId));
|
||||
transform.rotation = MjEngineTool.UnityQuaternion(
|
||||
MjEngineTool.MjQuaternionAtEntry(data->xquat, MujocoId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,8 +35,10 @@ namespace Mujoco {
|
||||
}
|
||||
|
||||
public override unsafe void OnSyncState(MujocoLib.mjData_* data) {
|
||||
MjEngineTool.SetMjVector3(data->mocap_pos, transform.position, MujocoId);
|
||||
MjEngineTool.SetMjQuaternion(data->mocap_quat, transform.rotation, MujocoId);
|
||||
MjEngineTool.SetMjVector3(
|
||||
MjEngineTool.MjVector3AtEntry(data->mocap_pos, MujocoId), transform.position);
|
||||
MjEngineTool.SetMjQuaternion(
|
||||
MjEngineTool.MjQuaternionAtEntry(data->mocap_quat, MujocoId), transform.rotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user