VR body IK mimicking problem (searching for help).
Hello, i was hoping it would be possible to maybe find some help on this reddit page with solving task that i cant fully wrap my head around. I am no really experianced in coding nor would i consider my slef even amateur at it.
The problem: I am trying to find a solution of how to transfer VR inverse kinematics tracking on to an independent character model, to make it appear as if the character is mimicking the movement of the player.
footage from Valem's "What i learned making a VR game in 7 days"
(how the female charecter behaves in the GIF. is exactly what i am trying to achive. What Valem mantioned before showcasing this exact effect for a few seconds, is that this is an improvment from his preveos video series "making a body in VR". The video series is just a step by step on how to create Inverse Kinamatics for a charecter body in unity. I followed step by step his tutorial on how to make IK for a body, and got so far. But i have still no idea how to seperate the body and make it so that it follows the movments of the controllers but doesnt try to be in their exact possition) I went as far as to becom a patreon for valem in order to get his source code and unity projects hoping that what i am searching for would be there. But to my suprise, this part of making a charecter model mimic the players movments is completley skipped, even in the source files from the video "What i learned making a VR game in 7 days" contain no explanation how this could be achived. Ive also tried contacting Valem as a patreon but three weeks passed by and there was no information provided. He achived this effect so quick in his video, that it makes me thin that the silution must be actually pretty simple. Maby, somhow reasigning the tracking information on to a new center point. But i really struggle to understand how can that be done. This is the IK code that ive replicated from Valem's tutorials on how to achive IK using unitys animation rigging pacage:
using UnityEngine;
[System.Serializable]
public class VRMap
{
public Transform vrTarget;
public Transform rigTarget;
public Vector3 trackingPositionOffset;
public Vector3 trackingRotationOffset;
public void Map()
{
rigTarget.position = vrTarget.TransformPoint(trackingPositionOffset);
rigTarget.rotation = vrTarget.rotation * Quaternion.Euler(trackingRotationOffset);
}
}
public class VRRig : MonoBehaviour
{
[Range(0,1)]
public float turnSmoothness = 1;
public VRMap head;
public VRMap leftHand;
public VRMap rightHand;
public Transform headConstraint;
private Vector3 headBodyOffest;
void Start()
{
headBodyOffest = transform.position - headConstraint.position;
}
void FixedUpdate()
{
transform.position = headConstraint.position + headBodyOffest;
transform.forward = Vector3.Lerp(transform.forward,
Vector3.ProjectOnPlane(headConstraint.up,Vector3.up).normalized, turnSmoothness);
head.Map();
leftHand.Map();
rightHand.Map();
}
}
The code makes this panel appear in the inspector:
I was hoping to ask for help in this community, maybe someone knows the solution of how to separate the characters model from the OVRPlayerController and assign a new custom location where characters body would stay stable, but still would replicate exactly what the player is doing in virtual space. This mechanic is needed for an art diploma hapening very soon (hens why ive trunned to asking for help everyone that might stumble upon this). I look forward to any input to put this problem in the past. Bless you and have a nice day.
Your answer
Follow this Question
Related Questions
Does anyone know of any documentation about this effect? 1 Answer
Oculus Go storage file path 3 Answers
How do I make my raycast look up and down? 0 Answers
How to control VR camera and controllers in "Game" and "Scene" views when running on PC/mac? 0 Answers
Oculus Integration & Smooth object rotation by grab 0 Answers