
@Spoike, @madfox
Thanks guys, made a bit of progress. Turns out I may need a rotation matrix, need to figure out how to multiply them in QC.
I forgot to be more specific: I'm experimenting with making a spaceship combat mod, and some ships have turrets mounted on them, and to make it simpler those turrets can only yaw (relative to the ship), they work fine when there's nothing to attack and they just match the ship's angles, but when they're turned elsewhere, especially when the ship is tilted, they look funny because I initially tell them to always match the ship's X and Z angles, and the Y angle is different because the turret is looking at an enemy.
I hope I explained it well...

Maffs
#3121 posted by Spoike on 2023/12/25 00:01:28
Something like this:
void rotatevectorsbyangle(vector angle)
{
vector oldx=v_forward, oldy='0 0 0'-v_right, oldz=v_up;
angle_x = -angle_x;
makevectors(angle);
vector angx=v_forward, angy='0 0 0'-v_right, angz=v_up;
v_forward_x = angx_x*oldx_x + angx_y*oldy_x + angx_z*oldz_x;
v_forward_y = angx_x*oldx_y + angx_y*oldy_y + angx_z*oldz_y;
v_forward_z = angx_x*oldx_z + angx_y*oldy_z + angx_z*oldz_z;
v_right_x = angy_x*oldx_x + angy_y*oldy_x + angy_z*oldz_x;
v_right_y = angy_x*oldx_y + angy_y*oldy_y + angy_z*oldz_y;
v_right_z = angy_x*oldx_z + angy_y*oldy_z + angy_z*oldz_z;
v_up_x = angz_x*oldx_x + angz_y*oldy_x + angz_z*oldz_x;
v_up_y = angz_x*oldx_y + angz_y*oldy_y + angz_z*oldz_y;
v_up_z = angz_x*oldx_z + angz_y*oldy_z + angz_z*oldz_z;
v_right = '0 0 0'-v_right;
}
IIRC the initial v_forward/v_right/v_up must be the parent's vectors (from makevectors - beware pitch sign). the 'angle' arg is the child's angles relative to its parent ent.
You can then use vectoangles2 to compute your child model's angles, but if its an older engine then it'll ignore the up vector and give you a roll angle of 0 which will be glitchy if your parent is freely pitching/rolling.
actual 6dof stuff will require you to make clientside changes so the player's view angles don't get bounded weirdly etc.

#3121
Many thanks, works like a charm!