- Home /
Find distance between two points on two objects
It's hard to explain my situation properly in the title but I'll try here. I am using the Microsoft kinect with Unity. I am creating a training game for Taekwondo. I have created a tool to recorded myself performing moves such as a kick or punch and then want to practice the move against the recording and it tells me if I did it correctly.
In order to achieve this I pick a key-frame such as an outstretched fist. I take the position(Vector3) of the fist which gets compared every update against the fist of the practising player and if it is within a small distance of each other we have a valid movement.(I know this is not the ideal way to do this but I want to keep it simple)
This should have been simple until I realised that the fist position is recorded in world space instead of local to the character space. This means that when I recorded the move I would be standing in a different place relative to the kinect than when the player is playing. The character also has a root point in world space.
I need to know can I use the root position and fist position of the pre-recorded comparison frame (both Vector3) and the root position and the position of the fist from the user and come up with a way to change both fist positions so they are relative to the character.