Hello, I am trying to set the drivers position (3D) relative to the vehicle rotation. E.g. the driver seat is 45° to the front left from the cars origin with a distance of 2.
My first approach was to use Cos, Sin and Tan but this didn’t end up in the desired result. To be honest I am a bit confused by the 3D dimension.
Vector3 pos = vehicle.transform.position;
Quaternion dir = vehicle.transform.rotation;
driver.transform.position = new Vector3(pos.x + Mathf.Cos((45+dir.x)*Mathf.Deg2Rad)*2, pos.y + Mathf.Sin(dir.y*Mathf.Deg2Rad), pos.z + Mathf.Tan((45+dir.z)*Mathf.Deg2Rad)*2);