I have a sensor that provides quaternions which I would like to apply to a GameObject.
My currently working code is the following:
transform.rotation = new Quaternion(x, y, z, w);
This works correctly, it modifies the rotation of the GameObject it's attached to, in the way it supposed to rotate it.
However the problem is that constructing a new object every frame seems very wasteful, so I would like to modify the existing one. I've tried the following code:
transform.rotation.Set(x, y, z, w);
This code simply doesn't modify the rotation of the GameObject at all.
Can I modify the Quaternion of the GameObject without constructing a new object every time?