- Home /
[VR] CameraRig and Neck
Hello,
I am working on a VRProject. I have a character with a head and a body. I use the cameraRig contains in the SteamVRPlugin. But, I want to have the neck position because If the body copy the eye position and I look downward or upward, the body move.
So, do you have any idea to have the correct position of the neck on each frames ?
Thanks you in advance for your answers and sorry for my English. (Is not very bad but is not very very good ;)
Answer by mafff · Sep 18, 2018 at 03:32 PM
An easy way of estimating the position of the base of the neck is the following: start from the head's position, continue downwards along the vertical axis of the transform for a fixed length (the length of the neck) and you will reach the base of the neck. This is only an approximation and doesn't take into account the fact that the neck bends a bit, but it should be good enough for most uses. The code is very simple:
static Vector3 GetNeckPosition(Transform head, float neckLength)
{
return head.position - head.up * neckLength
}