bool SpawnInstance(NeuronActor actor) { if (actor == null || !ValidatePrefab()) { return(false); } NeuronAnimatorInstance instance = null; if (reservedInstances.Count == 0) { GameObject obj = GameObject.Instantiate(replicaPrefab, Vector3.zero, Quaternion.identity) as GameObject; instance = obj.GetComponent <NeuronAnimatorInstance>(); Debug.Log(string.Format("[NeuronInstancesManager] Bound instance {0} actor {1}", obj.name, actor.guid.ToString("N"))); instance.SetBoundActor(actor); } else { instance = reservedInstances[reservedInstances.Count - 1]; reservedInstances.RemoveAt(reservedInstances.Count - 1); Debug.Log(string.Format("[NeuronInstancesManager] Bound instance {0} actor {1}", instance.gameObject.name, actor.guid.ToString("N"))); instance.SetBoundActor(actor); } if (instance != null) { instances.Add(actor, instance); } return(true); }
void OnEnable() { // Connect to target machine source = NeuronConnection.Connect(address, port, commandServerPort, socketType); // Get first actor from source actor = source.AcquireActor(0); }
public NeuronAnimatorInstance(Animator animator, NeuronActor actor) : base(actor) { //Debug.Log("3"); boundAnimator = animator; UpdateOffset(); }
private string GenerateNeuronMasterInfo(int instanceIndex) { if (instanceIndex >= numOfInstances) { return(string.Empty); } NeuronAnimatorInstance instance = GetInstances()[instanceIndex]; if (instance == null) { return(string.Empty); } string line = string.Empty; NeuronActor actor = instance.GetActor(); if (actor != null) { line += string.Format("Data version: {0}.{1}.{2}.{3}\n", actor.version.Major, actor.version.Minor, actor.version.Revision, actor.version.BuildNumb); line += string.Format("Actor name: {0}\n", actor.name); line += string.Format("Actor index: {0}\n", actor.index); line += string.Format("With displacement: {0}\n", actor.withDisplacement); line += string.Format("With reference: {0}\n", actor.withReference); line += string.Format("Number of connections: {0}\n", NeuronConnection.numOfSources); line += string.Format("Number of active actors: {0}\n", actor.owner.numOfActiveActors); line += string.Format("Number of suspended actors: {0}\n", actor.owner.numOfSuspendedActors); } return(line); }
public void OnDisconnect(NeuronSource source) { NeuronActor[] activeActors = source.GetActiveActors(); for (int i = 0; i < activeActors.Length; ++i) { NeuronActor actor = activeActors[i]; NeuronAnimatorInstance instance = null; instances.TryGetValue(actor, out instance); if (instance != null) { instancesToDestroy.Add(instance); } } }
// apply transforms extracted from actor mocap data to bones public void ApplyMotion(NeuronActor actor, Vector3[] bonePositionOffsets, Vector3[] boneRotationOffsets) { // only rotation in vr mode on the hips if (allowHipRotation) { //SetPosition( NeuronBones.Hips, actor.GetReceivedPosition( NeuronBones.Hips ) ); SetRotation(NeuronBones.Hips, actor.GetReceivedRotation(NeuronBones.Hips)); } switch (ActiveMode) { case Modes.FULL_BODY: // Full body mode, apply to every bone for (int i = 1; i < (int)NeuronBones.NumOfBones && i < bones.Length; ++i) { SetRotation((NeuronBones)i, actor.GetReceivedRotation((NeuronBones)i)); } break; case Modes.RIGHT_ARM_FOLLOW_HMD: // Mode when the root rotation and position follows the HMD // apply to only valid bones and also adjust position of detached right arm if (motionUpdateMethod == UpdateMethod.Normal && rightArmTarget != null) { RightArmHolder.position = rightArmTarget.position; } for (int i = 0; i < validBones.Count; ++i) { SetRotation(validBones[i], actor.GetReceivedRotation(validBones[i])); } break; case Modes.RIGHT_HAND_OPTICAL_ASSISTED: // Move right lower arm to the optical assisted object including rotation // Then rotate the remaining bones of the hand: if (OpticalAssistanceObject != null) { bones [(int)NeuronBones.RightForeArm].position = OpticalAssistanceObject.position; bones [(int)NeuronBones.RightForeArm].rotation = OpticalAssistanceObject.rotation; for (int i = 0; i < validBones.Count; ++i) { SetRotation(validBones [i], actor.GetReceivedRotation(validBones [i])); } } break; } }
private string GenerateNeuronMasterInfo(int instanceIndex) { if (instanceIndex >= numOfInstances) { return(string.Empty); } NeuronAnimatorInstance instance = GetInstances()[instanceIndex]; if (instance == null) { return(string.Empty); } string line = string.Empty; NeuronActor actor = instance.GetActor(); if (actor != null) { line += string.Format("Data version: {0}.{1}.{2}.{3}\n", actor.version.Major, actor.version.Minor, actor.version.Revision, actor.version.BuildNumb); line += string.Format("Actor name: {0}\n", actor.name); line += string.Format("Actor index: {0}\n", actor.index); line += string.Format("With displacement: {0}\n", actor.withDisplacement); line += string.Format("With reference: {0}\n", actor.withReference); line += string.Format("Data frequency: {0}\n", actor.frequency); string temp = string.Empty; if (actor.combinationMode == NeuronDataReaderWraper.SensorCombinationModes.SC_ArmOnly) { temp = "arm only"; } else if (actor.combinationMode == NeuronDataReaderWraper.SensorCombinationModes.SC_UpperBody) { temp = "upper body"; } else if (actor.combinationMode == NeuronDataReaderWraper.SensorCombinationModes.SC_FullBody) { temp = "full body"; } line += string.Format("Combination mode: {0}\n", temp); line += string.Format("Number of connections: {0}\n", NeuronConnection.numOfSources); line += string.Format("Number of active actors: {0}\n", actor.owner.numOfActiveActors); line += string.Format("Number of suspended actors: {0}\n", actor.owner.numOfSuspendedActors); } return(line); }
void OnSuspendActor(NeuronActor actor) { NeuronAnimatorInstance instance = null; instances.TryGetValue(actor, out instance); if (instance != null) { if (instances.Count > numOfReserveInstances) { instancesToDestroy.Add(instance); } else { reservedInstances.Add(instance); instances.Remove(actor); } } }
// apply transforms extracted from actor mocap data to transforms of animator bones public static void ApplyMotion(NeuronActor actor, Animator animator, Vector3[] positionOffsets, Vector3[] rotationOffsets, bool hipsMove, float hipOffset) { if (actor == null || actor.timeStamp == 0) { return; } // apply Hips position if (hipsMove) { Vector3 hipPos = actor.GetReceivedPosition(NeuronBones.Hips); SetPosition(animator, HumanBodyBones.Hips, new Vector3(hipPos.x, hipPos.y + hipOffset, hipPos.z)); // + positionOffsets [(int)HumanBodyBones.Hips]); SetRotation(animator, HumanBodyBones.Hips, actor.GetReceivedRotation(NeuronBones.Hips)); } // apply positions /* if (actor.withDisplacement) * { * // legs * SetPosition(animator, HumanBodyBones.RightUpperLeg, actor.GetReceivedPosition(NeuronBones.RightUpLeg));// + positionOffsets[(int)HumanBodyBones.RightUpperLeg]); * SetPosition(animator, HumanBodyBones.RightLowerLeg, actor.GetReceivedPosition(NeuronBones.RightLeg)); * SetPosition(animator, HumanBodyBones.RightFoot, actor.GetReceivedPosition(NeuronBones.RightFoot)); * SetPosition(animator, HumanBodyBones.LeftUpperLeg, actor.GetReceivedPosition(NeuronBones.LeftUpLeg));// + positionOffsets[(int)HumanBodyBones.LeftUpperLeg]); * SetPosition(animator, HumanBodyBones.LeftLowerLeg, actor.GetReceivedPosition(NeuronBones.LeftLeg)); * SetPosition(animator, HumanBodyBones.LeftFoot, actor.GetReceivedPosition(NeuronBones.LeftFoot)); * * // spine * SetPosition(animator, HumanBodyBones.Spine, actor.GetReceivedPosition(NeuronBones.Spine)); * SetPosition(animator, HumanBodyBones.Chest, actor.GetReceivedPosition(NeuronBones.Spine3)); * SetPosition(animator, HumanBodyBones.Neck, actor.GetReceivedPosition(NeuronBones.Neck)); * SetPosition(animator, HumanBodyBones.Head, actor.GetReceivedPosition(NeuronBones.Head)); * * // right arm * SetPosition(animator, HumanBodyBones.RightShoulder, actor.GetReceivedPosition(NeuronBones.RightShoulder)); * SetPosition(animator, HumanBodyBones.RightUpperArm, actor.GetReceivedPosition(NeuronBones.RightArm)); * SetPosition(animator, HumanBodyBones.RightLowerArm, actor.GetReceivedPosition(NeuronBones.RightForeArm)); * * // right hand * SetPosition(animator, HumanBodyBones.RightHand, actor.GetReceivedPosition(NeuronBones.RightHand)); * SetPosition(animator, HumanBodyBones.RightThumbProximal, actor.GetReceivedPosition(NeuronBones.RightHandThumb1)); * SetPosition(animator, HumanBodyBones.RightThumbIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandThumb2)); * SetPosition(animator, HumanBodyBones.RightThumbDistal, actor.GetReceivedPosition(NeuronBones.RightHandThumb3)); * * SetPosition(animator, HumanBodyBones.RightIndexProximal, actor.GetReceivedPosition(NeuronBones.RightHandIndex1)); * SetPosition(animator, HumanBodyBones.RightIndexIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandIndex2)); * SetPosition(animator, HumanBodyBones.RightIndexDistal, actor.GetReceivedPosition(NeuronBones.RightHandIndex3)); * * SetPosition(animator, HumanBodyBones.RightMiddleProximal, actor.GetReceivedPosition(NeuronBones.RightHandMiddle1)); * SetPosition(animator, HumanBodyBones.RightMiddleIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandMiddle2)); * SetPosition(animator, HumanBodyBones.RightMiddleDistal, actor.GetReceivedPosition(NeuronBones.RightHandMiddle3)); * * SetPosition(animator, HumanBodyBones.RightRingProximal, actor.GetReceivedPosition(NeuronBones.RightHandRing1)); * SetPosition(animator, HumanBodyBones.RightRingIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandRing2)); * SetPosition(animator, HumanBodyBones.RightRingDistal, actor.GetReceivedPosition(NeuronBones.RightHandRing3)); * * SetPosition(animator, HumanBodyBones.RightLittleProximal, actor.GetReceivedPosition(NeuronBones.RightHandPinky1)); * SetPosition(animator, HumanBodyBones.RightLittleIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandPinky2)); * SetPosition(animator, HumanBodyBones.RightLittleDistal, actor.GetReceivedPosition(NeuronBones.RightHandPinky3)); * * // left arm * SetPosition(animator, HumanBodyBones.LeftShoulder, actor.GetReceivedPosition(NeuronBones.LeftShoulder)); * SetPosition(animator, HumanBodyBones.LeftUpperArm, actor.GetReceivedPosition(NeuronBones.LeftArm)); * SetPosition(animator, HumanBodyBones.LeftLowerArm, actor.GetReceivedPosition(NeuronBones.LeftForeArm)); * * // left hand * SetPosition(animator, HumanBodyBones.LeftHand, actor.GetReceivedPosition(NeuronBones.LeftHand)); * SetPosition(animator, HumanBodyBones.LeftThumbProximal, actor.GetReceivedPosition(NeuronBones.LeftHandThumb1)); * SetPosition(animator, HumanBodyBones.LeftThumbIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandThumb2)); * SetPosition(animator, HumanBodyBones.LeftThumbDistal, actor.GetReceivedPosition(NeuronBones.LeftHandThumb3)); * * SetPosition(animator, HumanBodyBones.LeftIndexProximal, actor.GetReceivedPosition(NeuronBones.LeftHandIndex1)); * SetPosition(animator, HumanBodyBones.LeftIndexIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandIndex2)); * SetPosition(animator, HumanBodyBones.LeftIndexDistal, actor.GetReceivedPosition(NeuronBones.LeftHandIndex3)); * * SetPosition(animator, HumanBodyBones.LeftMiddleProximal, actor.GetReceivedPosition(NeuronBones.LeftHandMiddle1)); * SetPosition(animator, HumanBodyBones.LeftMiddleIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandMiddle2)); * SetPosition(animator, HumanBodyBones.LeftMiddleDistal, actor.GetReceivedPosition(NeuronBones.LeftHandMiddle3)); * * SetPosition(animator, HumanBodyBones.LeftRingProximal, actor.GetReceivedPosition(NeuronBones.LeftHandRing1)); * SetPosition(animator, HumanBodyBones.LeftRingIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandRing2)); * SetPosition(animator, HumanBodyBones.LeftRingDistal, actor.GetReceivedPosition(NeuronBones.LeftHandRing3)); * * SetPosition(animator, HumanBodyBones.LeftLittleProximal, actor.GetReceivedPosition(NeuronBones.LeftHandPinky1)); * SetPosition(animator, HumanBodyBones.LeftLittleIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandPinky2)); * SetPosition(animator, HumanBodyBones.LeftLittleDistal, actor.GetReceivedPosition(NeuronBones.LeftHandPinky3)); * }*/ // apply rotations // legs SetRotation(animator, HumanBodyBones.RightUpperLeg, actor.GetReceivedRotation(NeuronBones.RightUpLeg)); SetRotation(animator, HumanBodyBones.RightLowerLeg, actor.GetReceivedRotation(NeuronBones.RightLeg)); SetRotation(animator, HumanBodyBones.RightFoot, actor.GetReceivedRotation(NeuronBones.RightFoot)); SetRotation(animator, HumanBodyBones.LeftUpperLeg, actor.GetReceivedRotation(NeuronBones.LeftUpLeg)); SetRotation(animator, HumanBodyBones.LeftLowerLeg, actor.GetReceivedRotation(NeuronBones.LeftLeg)); SetRotation(animator, HumanBodyBones.LeftFoot, actor.GetReceivedRotation(NeuronBones.LeftFoot)); // spine SetRotation(animator, HumanBodyBones.Spine, actor.GetReceivedRotation(NeuronBones.Spine)); SetRotation(animator, HumanBodyBones.Chest, actor.GetReceivedRotation(NeuronBones.Spine1) + actor.GetReceivedRotation(NeuronBones.Spine2) + actor.GetReceivedRotation(NeuronBones.Spine3)); SetRotation(animator, HumanBodyBones.Neck, actor.GetReceivedRotation(NeuronBones.Neck)); SetRotation(animator, HumanBodyBones.Head, actor.GetReceivedRotation(NeuronBones.Head)); // right arm SetRotation(animator, HumanBodyBones.RightShoulder, actor.GetReceivedRotation(NeuronBones.RightShoulder)); SetRotation(animator, HumanBodyBones.RightUpperArm, actor.GetReceivedRotation(NeuronBones.RightArm)); SetRotation(animator, HumanBodyBones.RightLowerArm, actor.GetReceivedRotation(NeuronBones.RightForeArm)); // right hand SetRotation(animator, HumanBodyBones.RightHand, actor.GetReceivedRotation(NeuronBones.RightHand)); SetRotation(animator, HumanBodyBones.RightThumbProximal, actor.GetReceivedRotation(NeuronBones.RightHandThumb1)); SetRotation(animator, HumanBodyBones.RightThumbIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandThumb2)); SetRotation(animator, HumanBodyBones.RightThumbDistal, actor.GetReceivedRotation(NeuronBones.RightHandThumb3)); SetRotation(animator, HumanBodyBones.RightIndexProximal, actor.GetReceivedRotation(NeuronBones.RightHandIndex1) + actor.GetReceivedRotation(NeuronBones.RightInHandIndex)); SetRotation(animator, HumanBodyBones.RightIndexIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandIndex2)); SetRotation(animator, HumanBodyBones.RightIndexDistal, actor.GetReceivedRotation(NeuronBones.RightHandIndex3)); SetRotation(animator, HumanBodyBones.RightMiddleProximal, actor.GetReceivedRotation(NeuronBones.RightHandMiddle1) + actor.GetReceivedRotation(NeuronBones.RightInHandMiddle)); SetRotation(animator, HumanBodyBones.RightMiddleIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandMiddle2)); SetRotation(animator, HumanBodyBones.RightMiddleDistal, actor.GetReceivedRotation(NeuronBones.RightHandMiddle3)); SetRotation(animator, HumanBodyBones.RightRingProximal, actor.GetReceivedRotation(NeuronBones.RightHandRing1) + actor.GetReceivedRotation(NeuronBones.RightInHandRing)); SetRotation(animator, HumanBodyBones.RightRingIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandRing2)); SetRotation(animator, HumanBodyBones.RightRingDistal, actor.GetReceivedRotation(NeuronBones.RightHandRing3)); SetRotation(animator, HumanBodyBones.RightLittleProximal, actor.GetReceivedRotation(NeuronBones.RightHandPinky1) + actor.GetReceivedRotation(NeuronBones.RightInHandPinky)); SetRotation(animator, HumanBodyBones.RightLittleIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandPinky2)); SetRotation(animator, HumanBodyBones.RightLittleDistal, actor.GetReceivedRotation(NeuronBones.RightHandPinky3)); // left arm SetRotation(animator, HumanBodyBones.LeftShoulder, actor.GetReceivedRotation(NeuronBones.LeftShoulder)); SetRotation(animator, HumanBodyBones.LeftUpperArm, actor.GetReceivedRotation(NeuronBones.LeftArm)); SetRotation(animator, HumanBodyBones.LeftLowerArm, actor.GetReceivedRotation(NeuronBones.LeftForeArm)); // left hand SetRotation(animator, HumanBodyBones.LeftHand, actor.GetReceivedRotation(NeuronBones.LeftHand)); SetRotation(animator, HumanBodyBones.LeftThumbProximal, actor.GetReceivedRotation(NeuronBones.LeftHandThumb1)); SetRotation(animator, HumanBodyBones.LeftThumbIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandThumb2)); SetRotation(animator, HumanBodyBones.LeftThumbDistal, actor.GetReceivedRotation(NeuronBones.LeftHandThumb3)); SetRotation(animator, HumanBodyBones.LeftIndexProximal, actor.GetReceivedRotation(NeuronBones.LeftHandIndex1) + actor.GetReceivedRotation(NeuronBones.LeftInHandIndex)); SetRotation(animator, HumanBodyBones.LeftIndexIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandIndex2)); SetRotation(animator, HumanBodyBones.LeftIndexDistal, actor.GetReceivedRotation(NeuronBones.LeftHandIndex3)); SetRotation(animator, HumanBodyBones.LeftMiddleProximal, actor.GetReceivedRotation(NeuronBones.LeftHandMiddle1) + actor.GetReceivedRotation(NeuronBones.LeftInHandMiddle)); SetRotation(animator, HumanBodyBones.LeftMiddleIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandMiddle2)); SetRotation(animator, HumanBodyBones.LeftMiddleDistal, actor.GetReceivedRotation(NeuronBones.LeftHandMiddle3)); SetRotation(animator, HumanBodyBones.LeftRingProximal, actor.GetReceivedRotation(NeuronBones.LeftHandRing1) + actor.GetReceivedRotation(NeuronBones.LeftInHandRing)); SetRotation(animator, HumanBodyBones.LeftRingIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandRing2)); SetRotation(animator, HumanBodyBones.LeftRingDistal, actor.GetReceivedRotation(NeuronBones.LeftHandRing3)); SetRotation(animator, HumanBodyBones.LeftLittleProximal, actor.GetReceivedRotation(NeuronBones.LeftHandPinky1) + actor.GetReceivedRotation(NeuronBones.LeftInHandPinky)); SetRotation(animator, HumanBodyBones.LeftLittleIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandPinky2)); SetRotation(animator, HumanBodyBones.LeftLittleDistal, actor.GetReceivedRotation(NeuronBones.LeftHandPinky3)); }
public NeuronAnimatorInstance(NeuronActor actor) : base(actor) { //Debug.Log("4"); }
public NeuronAnimatorInstanceBVH(NeuronActor actor) { }
// apply transforms extracted from actor mocap data to transforms of animator bones public static void ApplyMotion(NeuronActor actor, Animator animator, Vector3[] positionOffsets, Vector3[] rotationOffsets) { // apply Hips position SetPosition(animator, HumanBodyBones.Hips, actor.GetReceivedPosition(NeuronBones.Hips) + positionOffsets[(int)HumanBodyBones.Hips]); SetRotation(animator, HumanBodyBones.Hips, actor.GetReceivedRotation(NeuronBones.Hips)); // apply positions if (actor.withDisplacement) { // legs SetPosition(animator, HumanBodyBones.RightUpperLeg, actor.GetReceivedPosition(NeuronBones.RightUpLeg) + positionOffsets[(int)HumanBodyBones.RightUpperLeg]); SetPosition(animator, HumanBodyBones.RightLowerLeg, actor.GetReceivedPosition(NeuronBones.RightLeg)); SetPosition(animator, HumanBodyBones.RightFoot, actor.GetReceivedPosition(NeuronBones.RightFoot)); SetPosition(animator, HumanBodyBones.LeftUpperLeg, actor.GetReceivedPosition(NeuronBones.LeftUpLeg) + positionOffsets[(int)HumanBodyBones.LeftUpperLeg]); SetPosition(animator, HumanBodyBones.LeftLowerLeg, actor.GetReceivedPosition(NeuronBones.LeftLeg)); SetPosition(animator, HumanBodyBones.LeftFoot, actor.GetReceivedPosition(NeuronBones.LeftFoot)); // spine SetPosition(animator, HumanBodyBones.Spine, actor.GetReceivedPosition(NeuronBones.Spine)); SetPosition(animator, HumanBodyBones.Chest, actor.GetReceivedPosition(NeuronBones.Spine3)); SetPosition(animator, HumanBodyBones.Neck, actor.GetReceivedPosition(NeuronBones.Neck)); SetPosition(animator, HumanBodyBones.Head, actor.GetReceivedPosition(NeuronBones.Head)); // right arm SetPosition(animator, HumanBodyBones.RightShoulder, actor.GetReceivedPosition(NeuronBones.RightShoulder)); SetPosition(animator, HumanBodyBones.RightUpperArm, actor.GetReceivedPosition(NeuronBones.RightArm)); SetPosition(animator, HumanBodyBones.RightLowerArm, actor.GetReceivedPosition(NeuronBones.RightForeArm)); // right hand SetPosition(animator, HumanBodyBones.RightHand, actor.GetReceivedPosition(NeuronBones.RightHand)); SetPosition(animator, HumanBodyBones.RightThumbProximal, actor.GetReceivedPosition(NeuronBones.RightHandThumb1)); SetPosition(animator, HumanBodyBones.RightThumbIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandThumb2)); SetPosition(animator, HumanBodyBones.RightThumbDistal, actor.GetReceivedPosition(NeuronBones.RightHandThumb3)); SetPosition(animator, HumanBodyBones.RightIndexProximal, actor.GetReceivedPosition(NeuronBones.RightHandIndex1)); SetPosition(animator, HumanBodyBones.RightIndexIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandIndex2)); SetPosition(animator, HumanBodyBones.RightIndexDistal, actor.GetReceivedPosition(NeuronBones.RightHandIndex3)); SetPosition(animator, HumanBodyBones.RightMiddleProximal, actor.GetReceivedPosition(NeuronBones.RightHandMiddle1)); SetPosition(animator, HumanBodyBones.RightMiddleIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandMiddle2)); SetPosition(animator, HumanBodyBones.RightMiddleDistal, actor.GetReceivedPosition(NeuronBones.RightHandMiddle3)); SetPosition(animator, HumanBodyBones.RightRingProximal, actor.GetReceivedPosition(NeuronBones.RightHandRing1)); SetPosition(animator, HumanBodyBones.RightRingIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandRing2)); SetPosition(animator, HumanBodyBones.RightRingDistal, actor.GetReceivedPosition(NeuronBones.RightHandRing3)); SetPosition(animator, HumanBodyBones.RightLittleProximal, actor.GetReceivedPosition(NeuronBones.RightHandPinky1)); SetPosition(animator, HumanBodyBones.RightLittleIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandPinky2)); SetPosition(animator, HumanBodyBones.RightLittleDistal, actor.GetReceivedPosition(NeuronBones.RightHandPinky3)); // left arm SetPosition(animator, HumanBodyBones.LeftShoulder, actor.GetReceivedPosition(NeuronBones.LeftShoulder)); SetPosition(animator, HumanBodyBones.LeftUpperArm, actor.GetReceivedPosition(NeuronBones.LeftArm)); SetPosition(animator, HumanBodyBones.LeftLowerArm, actor.GetReceivedPosition(NeuronBones.LeftForeArm)); // left hand SetPosition(animator, HumanBodyBones.LeftHand, actor.GetReceivedPosition(NeuronBones.LeftHand)); SetPosition(animator, HumanBodyBones.LeftThumbProximal, actor.GetReceivedPosition(NeuronBones.LeftHandThumb1)); SetPosition(animator, HumanBodyBones.LeftThumbIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandThumb2)); SetPosition(animator, HumanBodyBones.LeftThumbDistal, actor.GetReceivedPosition(NeuronBones.LeftHandThumb3)); SetPosition(animator, HumanBodyBones.LeftIndexProximal, actor.GetReceivedPosition(NeuronBones.LeftHandIndex1)); SetPosition(animator, HumanBodyBones.LeftIndexIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandIndex2)); SetPosition(animator, HumanBodyBones.LeftIndexDistal, actor.GetReceivedPosition(NeuronBones.LeftHandIndex3)); SetPosition(animator, HumanBodyBones.LeftMiddleProximal, actor.GetReceivedPosition(NeuronBones.LeftHandMiddle1)); SetPosition(animator, HumanBodyBones.LeftMiddleIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandMiddle2)); SetPosition(animator, HumanBodyBones.LeftMiddleDistal, actor.GetReceivedPosition(NeuronBones.LeftHandMiddle3)); SetPosition(animator, HumanBodyBones.LeftRingProximal, actor.GetReceivedPosition(NeuronBones.LeftHandRing1)); SetPosition(animator, HumanBodyBones.LeftRingIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandRing2)); SetPosition(animator, HumanBodyBones.LeftRingDistal, actor.GetReceivedPosition(NeuronBones.LeftHandRing3)); SetPosition(animator, HumanBodyBones.LeftLittleProximal, actor.GetReceivedPosition(NeuronBones.LeftHandPinky1)); SetPosition(animator, HumanBodyBones.LeftLittleIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandPinky2)); SetPosition(animator, HumanBodyBones.LeftLittleDistal, actor.GetReceivedPosition(NeuronBones.LeftHandPinky3)); } // apply rotations // legs SetRotation(animator, HumanBodyBones.RightUpperLeg, actor.GetReceivedRotation(NeuronBones.RightUpLeg)); SetRotation(animator, HumanBodyBones.RightLowerLeg, actor.GetReceivedRotation(NeuronBones.RightLeg)); SetRotation(animator, HumanBodyBones.RightFoot, actor.GetReceivedRotation(NeuronBones.RightFoot)); SetRotation(animator, HumanBodyBones.LeftUpperLeg, actor.GetReceivedRotation(NeuronBones.LeftUpLeg)); SetRotation(animator, HumanBodyBones.LeftLowerLeg, actor.GetReceivedRotation(NeuronBones.LeftLeg)); SetRotation(animator, HumanBodyBones.LeftFoot, actor.GetReceivedRotation(NeuronBones.LeftFoot)); // spine SetRotation(animator, HumanBodyBones.Spine, actor.GetReceivedRotation(NeuronBones.Spine)); SetRotation(animator, HumanBodyBones.Chest, actor.GetReceivedRotation(NeuronBones.Spine1) + actor.GetReceivedRotation(NeuronBones.Spine2) + actor.GetReceivedRotation(NeuronBones.Spine3)); SetRotation(animator, HumanBodyBones.Neck, actor.GetReceivedRotation(NeuronBones.Neck)); SetRotation(animator, HumanBodyBones.Head, actor.GetReceivedRotation(NeuronBones.Head)); // right arm SetRotation(animator, HumanBodyBones.RightShoulder, actor.GetReceivedRotation(NeuronBones.RightShoulder)); SetRotation(animator, HumanBodyBones.RightUpperArm, actor.GetReceivedRotation(NeuronBones.RightArm)); SetRotation(animator, HumanBodyBones.RightLowerArm, actor.GetReceivedRotation(NeuronBones.RightForeArm)); // right hand SetRotation(animator, HumanBodyBones.RightHand, actor.GetReceivedRotation(NeuronBones.RightHand)); SetRotation(animator, HumanBodyBones.RightThumbProximal, actor.GetReceivedRotation(NeuronBones.RightHandThumb1)); SetRotation(animator, HumanBodyBones.RightThumbIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandThumb2)); SetRotation(animator, HumanBodyBones.RightThumbDistal, actor.GetReceivedRotation(NeuronBones.RightHandThumb3)); SetRotation(animator, HumanBodyBones.RightIndexProximal, actor.GetReceivedRotation(NeuronBones.RightHandIndex1) + actor.GetReceivedRotation(NeuronBones.RightInHandIndex)); SetRotation(animator, HumanBodyBones.RightIndexIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandIndex2)); SetRotation(animator, HumanBodyBones.RightIndexDistal, actor.GetReceivedRotation(NeuronBones.RightHandIndex3)); SetRotation(animator, HumanBodyBones.RightMiddleProximal, actor.GetReceivedRotation(NeuronBones.RightHandMiddle1) + actor.GetReceivedRotation(NeuronBones.RightInHandMiddle)); SetRotation(animator, HumanBodyBones.RightMiddleIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandMiddle2)); SetRotation(animator, HumanBodyBones.RightMiddleDistal, actor.GetReceivedRotation(NeuronBones.RightHandMiddle3)); SetRotation(animator, HumanBodyBones.RightRingProximal, actor.GetReceivedRotation(NeuronBones.RightHandRing1) + actor.GetReceivedRotation(NeuronBones.RightInHandRing)); SetRotation(animator, HumanBodyBones.RightRingIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandRing2)); SetRotation(animator, HumanBodyBones.RightRingDistal, actor.GetReceivedRotation(NeuronBones.RightHandRing3)); SetRotation(animator, HumanBodyBones.RightLittleProximal, actor.GetReceivedRotation(NeuronBones.RightHandPinky1) + actor.GetReceivedRotation(NeuronBones.RightInHandPinky)); SetRotation(animator, HumanBodyBones.RightLittleIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandPinky2)); SetRotation(animator, HumanBodyBones.RightLittleDistal, actor.GetReceivedRotation(NeuronBones.RightHandPinky3)); // left arm SetRotation(animator, HumanBodyBones.LeftShoulder, actor.GetReceivedRotation(NeuronBones.LeftShoulder)); SetRotation(animator, HumanBodyBones.LeftUpperArm, actor.GetReceivedRotation(NeuronBones.LeftArm)); SetRotation(animator, HumanBodyBones.LeftLowerArm, actor.GetReceivedRotation(NeuronBones.LeftForeArm)); // left hand SetRotation(animator, HumanBodyBones.LeftHand, actor.GetReceivedRotation(NeuronBones.LeftHand)); SetRotation(animator, HumanBodyBones.LeftThumbProximal, actor.GetReceivedRotation(NeuronBones.LeftHandThumb1)); SetRotation(animator, HumanBodyBones.LeftThumbIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandThumb2)); SetRotation(animator, HumanBodyBones.LeftThumbDistal, actor.GetReceivedRotation(NeuronBones.LeftHandThumb3)); SetRotation(animator, HumanBodyBones.LeftIndexProximal, actor.GetReceivedRotation(NeuronBones.LeftHandIndex1) + actor.GetReceivedRotation(NeuronBones.LeftInHandIndex)); SetRotation(animator, HumanBodyBones.LeftIndexIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandIndex2)); SetRotation(animator, HumanBodyBones.LeftIndexDistal, actor.GetReceivedRotation(NeuronBones.LeftHandIndex3)); SetRotation(animator, HumanBodyBones.LeftMiddleProximal, actor.GetReceivedRotation(NeuronBones.LeftHandMiddle1) + actor.GetReceivedRotation(NeuronBones.LeftInHandMiddle)); SetRotation(animator, HumanBodyBones.LeftMiddleIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandMiddle2)); SetRotation(animator, HumanBodyBones.LeftMiddleDistal, actor.GetReceivedRotation(NeuronBones.LeftHandMiddle3)); SetRotation(animator, HumanBodyBones.LeftRingProximal, actor.GetReceivedRotation(NeuronBones.LeftHandRing1) + actor.GetReceivedRotation(NeuronBones.LeftInHandRing)); SetRotation(animator, HumanBodyBones.LeftRingIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandRing2)); SetRotation(animator, HumanBodyBones.LeftRingDistal, actor.GetReceivedRotation(NeuronBones.LeftHandRing3)); SetRotation(animator, HumanBodyBones.LeftLittleProximal, actor.GetReceivedRotation(NeuronBones.LeftHandPinky1) + actor.GetReceivedRotation(NeuronBones.LeftInHandPinky)); SetRotation(animator, HumanBodyBones.LeftLittleIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandPinky2)); SetRotation(animator, HumanBodyBones.LeftLittleDistal, actor.GetReceivedRotation(NeuronBones.LeftHandPinky3)); }
// apply transforms extracted from actor mocap data to transforms of animator bones public static void ApplyMotion(NeuronActor actor, Animator animator, Vector3[] positionOffsets, Vector3[] rotationOffsets) { // apply Hips position SetPosition(animator, HumanBodyBones.Hips, actor.GetReceivedPosition(NeuronBones.Hips) + positionOffsets[(int)HumanBodyBones.Hips]); SetRotation(animator, HumanBodyBones.Hips, actor.GetReceivedRotation(NeuronBones.Hips)); // apply positions if (actor.withDisplacement) { // legs SetPosition(animator, HumanBodyBones.RightUpperLeg, actor.GetReceivedPosition(NeuronBones.RightUpLeg) + positionOffsets[(int)HumanBodyBones.RightUpperLeg]); SetPosition(animator, HumanBodyBones.RightLowerLeg, actor.GetReceivedPosition(NeuronBones.RightLeg)); SetPosition(animator, HumanBodyBones.RightFoot, actor.GetReceivedPosition(NeuronBones.RightFoot)); SetPosition(animator, HumanBodyBones.LeftUpperLeg, actor.GetReceivedPosition(NeuronBones.LeftUpLeg) + positionOffsets[(int)HumanBodyBones.LeftUpperLeg]); SetPosition(animator, HumanBodyBones.LeftLowerLeg, actor.GetReceivedPosition(NeuronBones.LeftLeg)); SetPosition(animator, HumanBodyBones.LeftFoot, actor.GetReceivedPosition(NeuronBones.LeftFoot)); // spine SetPosition(animator, HumanBodyBones.Spine, actor.GetReceivedPosition(NeuronBones.Spine)); SetPosition(animator, HumanBodyBones.Chest, actor.GetReceivedPosition(NeuronBones.Spine3)); SetPosition(animator, HumanBodyBones.Neck, actor.GetReceivedPosition(NeuronBones.Neck)); SetPosition(animator, HumanBodyBones.Head, actor.GetReceivedPosition(NeuronBones.Head)); // right arm SetPosition(animator, HumanBodyBones.RightShoulder, actor.GetReceivedPosition(NeuronBones.RightShoulder)); SetPosition(animator, HumanBodyBones.RightUpperArm, actor.GetReceivedPosition(NeuronBones.RightArm)); SetPosition(animator, HumanBodyBones.RightLowerArm, actor.GetReceivedPosition(NeuronBones.RightForeArm)); // right hand SetPosition(animator, HumanBodyBones.RightHand, actor.GetReceivedPosition(NeuronBones.RightHand)); SetPosition(animator, HumanBodyBones.RightThumbProximal, actor.GetReceivedPosition(NeuronBones.RightHandThumb1)); SetPosition(animator, HumanBodyBones.RightThumbIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandThumb2)); SetPosition(animator, HumanBodyBones.RightThumbDistal, actor.GetReceivedPosition(NeuronBones.RightHandThumb3)); SetPosition(animator, HumanBodyBones.RightIndexProximal, actor.GetReceivedPosition(NeuronBones.RightHandIndex1)); SetPosition(animator, HumanBodyBones.RightIndexIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandIndex2)); SetPosition(animator, HumanBodyBones.RightIndexDistal, actor.GetReceivedPosition(NeuronBones.RightHandIndex3)); SetPosition(animator, HumanBodyBones.RightMiddleProximal, actor.GetReceivedPosition(NeuronBones.RightHandMiddle1)); SetPosition(animator, HumanBodyBones.RightMiddleIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandMiddle2)); SetPosition(animator, HumanBodyBones.RightMiddleDistal, actor.GetReceivedPosition(NeuronBones.RightHandMiddle3)); SetPosition(animator, HumanBodyBones.RightRingProximal, actor.GetReceivedPosition(NeuronBones.RightHandRing1)); SetPosition(animator, HumanBodyBones.RightRingIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandRing2)); SetPosition(animator, HumanBodyBones.RightRingDistal, actor.GetReceivedPosition(NeuronBones.RightHandRing3)); SetPosition(animator, HumanBodyBones.RightLittleProximal, actor.GetReceivedPosition(NeuronBones.RightHandPinky1)); SetPosition(animator, HumanBodyBones.RightLittleIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandPinky2)); SetPosition(animator, HumanBodyBones.RightLittleDistal, actor.GetReceivedPosition(NeuronBones.RightHandPinky3)); // left arm SetPosition(animator, HumanBodyBones.LeftShoulder, actor.GetReceivedPosition(NeuronBones.LeftShoulder)); SetPosition(animator, HumanBodyBones.LeftUpperArm, actor.GetReceivedPosition(NeuronBones.LeftArm)); SetPosition(animator, HumanBodyBones.LeftLowerArm, actor.GetReceivedPosition(NeuronBones.LeftForeArm)); // left hand SetPosition(animator, HumanBodyBones.LeftHand, actor.GetReceivedPosition(NeuronBones.LeftHand)); SetPosition(animator, HumanBodyBones.LeftThumbProximal, actor.GetReceivedPosition(NeuronBones.LeftHandThumb1)); SetPosition(animator, HumanBodyBones.LeftThumbIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandThumb2)); SetPosition(animator, HumanBodyBones.LeftThumbDistal, actor.GetReceivedPosition(NeuronBones.LeftHandThumb3)); SetPosition(animator, HumanBodyBones.LeftIndexProximal, actor.GetReceivedPosition(NeuronBones.LeftHandIndex1)); SetPosition(animator, HumanBodyBones.LeftIndexIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandIndex2)); SetPosition(animator, HumanBodyBones.LeftIndexDistal, actor.GetReceivedPosition(NeuronBones.LeftHandIndex3)); SetPosition(animator, HumanBodyBones.LeftMiddleProximal, actor.GetReceivedPosition(NeuronBones.LeftHandMiddle1)); SetPosition(animator, HumanBodyBones.LeftMiddleIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandMiddle2)); SetPosition(animator, HumanBodyBones.LeftMiddleDistal, actor.GetReceivedPosition(NeuronBones.LeftHandMiddle3)); SetPosition(animator, HumanBodyBones.LeftRingProximal, actor.GetReceivedPosition(NeuronBones.LeftHandRing1)); SetPosition(animator, HumanBodyBones.LeftRingIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandRing2)); SetPosition(animator, HumanBodyBones.LeftRingDistal, actor.GetReceivedPosition(NeuronBones.LeftHandRing3)); SetPosition(animator, HumanBodyBones.LeftLittleProximal, actor.GetReceivedPosition(NeuronBones.LeftHandPinky1)); SetPosition(animator, HumanBodyBones.LeftLittleIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandPinky2)); SetPosition(animator, HumanBodyBones.LeftLittleDistal, actor.GetReceivedPosition(NeuronBones.LeftHandPinky3)); } // apply rotations // legs SetRotation(animator, HumanBodyBones.RightUpperLeg, actor.GetReceivedRotation(NeuronBones.RightUpLeg)); SetRotation(animator, HumanBodyBones.RightLowerLeg, actor.GetReceivedRotation(NeuronBones.RightLeg)); SetRotation(animator, HumanBodyBones.RightFoot, actor.GetReceivedRotation(NeuronBones.RightFoot)); SetRotation(animator, HumanBodyBones.LeftUpperLeg, actor.GetReceivedRotation(NeuronBones.LeftUpLeg)); SetRotation(animator, HumanBodyBones.LeftLowerLeg, actor.GetReceivedRotation(NeuronBones.LeftLeg)); SetRotation(animator, HumanBodyBones.LeftFoot, actor.GetReceivedRotation(NeuronBones.LeftFoot)); // spine SetRotation(animator, HumanBodyBones.Spine, actor.GetReceivedRotation(NeuronBones.Spine)); SetRotation(animator, HumanBodyBones.Chest, actor.GetReceivedRotation(NeuronBones.Spine1) + actor.GetReceivedRotation(NeuronBones.Spine2) + actor.GetReceivedRotation(NeuronBones.Spine3)); SetRotation(animator, HumanBodyBones.Neck, actor.GetReceivedRotation(NeuronBones.Neck)); SetRotation(animator, HumanBodyBones.Head, actor.GetReceivedRotation(NeuronBones.Head)); // right arm SetRotation(animator, HumanBodyBones.RightShoulder, actor.GetReceivedRotation(NeuronBones.RightShoulder)); SetRotation(animator, HumanBodyBones.RightUpperArm, actor.GetReceivedRotation(NeuronBones.RightArm)); SetRotation(animator, HumanBodyBones.RightLowerArm, actor.GetReceivedRotation(NeuronBones.RightForeArm)); // right hand SetRotation(animator, HumanBodyBones.RightHand, actor.GetReceivedRotation(NeuronBones.RightHand)); SetRotation(animator, HumanBodyBones.RightThumbProximal, actor.GetReceivedRotation(NeuronBones.RightHandThumb1)); SetRotation(animator, HumanBodyBones.RightThumbIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandThumb2)); SetRotation(animator, HumanBodyBones.RightThumbDistal, actor.GetReceivedRotation(NeuronBones.RightHandThumb3)); SetRotation(animator, HumanBodyBones.RightIndexProximal, actor.GetReceivedRotation(NeuronBones.RightHandIndex1) + actor.GetReceivedRotation(NeuronBones.RightInHandIndex)); SetRotation(animator, HumanBodyBones.RightIndexIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandIndex2)); SetRotation(animator, HumanBodyBones.RightIndexDistal, actor.GetReceivedRotation(NeuronBones.RightHandIndex3)); SetRotation(animator, HumanBodyBones.RightMiddleProximal, actor.GetReceivedRotation(NeuronBones.RightHandMiddle1) + actor.GetReceivedRotation(NeuronBones.RightInHandMiddle)); SetRotation(animator, HumanBodyBones.RightMiddleIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandMiddle2)); SetRotation(animator, HumanBodyBones.RightMiddleDistal, actor.GetReceivedRotation(NeuronBones.RightHandMiddle3)); SetRotation(animator, HumanBodyBones.RightRingProximal, actor.GetReceivedRotation(NeuronBones.RightHandRing1) + actor.GetReceivedRotation(NeuronBones.RightInHandRing)); SetRotation(animator, HumanBodyBones.RightRingIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandRing2)); SetRotation(animator, HumanBodyBones.RightRingDistal, actor.GetReceivedRotation(NeuronBones.RightHandRing3)); SetRotation(animator, HumanBodyBones.RightLittleProximal, actor.GetReceivedRotation(NeuronBones.RightHandPinky1) + actor.GetReceivedRotation(NeuronBones.RightInHandPinky)); SetRotation(animator, HumanBodyBones.RightLittleIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandPinky2)); SetRotation(animator, HumanBodyBones.RightLittleDistal, actor.GetReceivedRotation(NeuronBones.RightHandPinky3)); // left arm SetRotation(animator, HumanBodyBones.LeftShoulder, actor.GetReceivedRotation(NeuronBones.LeftShoulder)); SetRotation(animator, HumanBodyBones.LeftUpperArm, actor.GetReceivedRotation(NeuronBones.LeftArm)); SetRotation(animator, HumanBodyBones.LeftLowerArm, actor.GetReceivedRotation(NeuronBones.LeftForeArm)); // left hand SetRotation(animator, HumanBodyBones.LeftHand, actor.GetReceivedRotation(NeuronBones.LeftHand)); SetRotation(animator, HumanBodyBones.LeftThumbProximal, actor.GetReceivedRotation(NeuronBones.LeftHandThumb1)); SetRotation(animator, HumanBodyBones.LeftThumbIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandThumb2)); SetRotation(animator, HumanBodyBones.LeftThumbDistal, actor.GetReceivedRotation(NeuronBones.LeftHandThumb3)); SetRotation(animator, HumanBodyBones.LeftIndexProximal, actor.GetReceivedRotation(NeuronBones.LeftHandIndex1) + actor.GetReceivedRotation(NeuronBones.LeftInHandIndex)); SetRotation(animator, HumanBodyBones.LeftIndexIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandIndex2)); SetRotation(animator, HumanBodyBones.LeftIndexDistal, actor.GetReceivedRotation(NeuronBones.LeftHandIndex3)); SetRotation(animator, HumanBodyBones.LeftMiddleProximal, actor.GetReceivedRotation(NeuronBones.LeftHandMiddle1) + actor.GetReceivedRotation(NeuronBones.LeftInHandMiddle)); SetRotation(animator, HumanBodyBones.LeftMiddleIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandMiddle2)); SetRotation(animator, HumanBodyBones.LeftMiddleDistal, actor.GetReceivedRotation(NeuronBones.LeftHandMiddle3)); SetRotation(animator, HumanBodyBones.LeftRingProximal, actor.GetReceivedRotation(NeuronBones.LeftHandRing1) + actor.GetReceivedRotation(NeuronBones.LeftInHandRing)); SetRotation(animator, HumanBodyBones.LeftRingIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandRing2)); SetRotation(animator, HumanBodyBones.LeftRingDistal, actor.GetReceivedRotation(NeuronBones.LeftHandRing3)); SetRotation(animator, HumanBodyBones.LeftLittleProximal, actor.GetReceivedRotation(NeuronBones.LeftHandPinky1) + actor.GetReceivedRotation(NeuronBones.LeftInHandPinky)); SetRotation(animator, HumanBodyBones.LeftLittleIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandPinky2)); SetRotation(animator, HumanBodyBones.LeftLittleDistal, actor.GetReceivedRotation(NeuronBones.LeftHandPinky3)); /* * String str; * if(!headerPrinted) * { * headerPrinted = true; * * Debug.Log("GettingPositionalData5674"); * str = "Data5674,"; * for (int i = 0; i < (int)HumanBodyBones.LastBone; i++) * { * str += ((HumanBodyBones)i).ToString() + ".x, " + ((HumanBodyBones)i).ToString() + ".y, " + ((HumanBodyBones)i).ToString() + ".z, "; * } * Debug.Log(str); * } * str = "Data5674,"; * for (int i = 0; i < (int)HumanBodyBones.LastBone; i++) * { * Transform t = animator.GetBoneTransform((HumanBodyBones)i); * if( t != null) * str += t.localPosition.x + ", " + t.localPosition.y + ", " + t.localPosition.z + ", "; * else * str += "0.0" + ", " + "0.0" + ", " + "0.0" + ", "; * } * Debug.Log(str); * */ }
void OnResumeActor(NeuronActor actor) { actorsToInstantiate.Add(actor); }
public NeuronTransformsInstanceVR(Transform root, string prefix, NeuronActor actor) : base(actor) { Bind(root, prefix); }
protected override void UpdateState() { if (_instance == null) { } else if (!Connect) { //NeuronConnection.Disconnect(_instance); //_instance = null; } if (_instance == null) { return; } if (_actor == null || _actor.actorID != ActorID) { _actor = _instance.AcquireActor(ActorID); } if (_actor == null) { return; } if (Body.GetPersistentEventCount() == 0) { return; } _instance.OnUpdate(); _body.Head.Position = _actor.GetReceivedPosition(NeuronBones.Head); _body.Head.Rotation = Quaternion.Euler(_actor.GetReceivedRotation(NeuronBones.Head)); _body.Neck.Position = _actor.GetReceivedPosition(NeuronBones.Neck); _body.Neck.Rotation = Quaternion.Euler(_actor.GetReceivedRotation(NeuronBones.Neck)); _body.Chest.Position = _actor.GetReceivedPosition(NeuronBones.Spine2); _body.Chest.Rotation = Quaternion.Euler(_actor.GetReceivedRotation(NeuronBones.Spine1) + _actor.GetReceivedRotation(NeuronBones.Spine2) + _actor.GetReceivedRotation(NeuronBones.Spine3)); _body.Waist.Position = _actor.GetReceivedPosition(NeuronBones.Hips); _body.Waist.Rotation = Quaternion.Euler(_actor.GetReceivedRotation(NeuronBones.Hips)); _body.LeftArm.shoulder.Position = _actor.GetReceivedPosition(NeuronBones.LeftShoulder); _body.LeftArm.shoulder.Rotation = Quaternion.Euler(_actor.GetReceivedRotation(NeuronBones.LeftShoulder)); _body.LeftArm.Clavicle.Position = _actor.GetReceivedPosition(NeuronBones.LeftArm); _body.LeftArm.Clavicle.Rotation = Quaternion.Euler(_actor.GetReceivedRotation(NeuronBones.LeftArm)); _body.LeftArm.Elbow.Position = _actor.GetReceivedPosition(NeuronBones.LeftForeArm); _body.LeftArm.Elbow.Rotation = Quaternion.Euler(_actor.GetReceivedRotation(NeuronBones.LeftForeArm)); _body.LeftArm.wrist.Position = _actor.GetReceivedPosition(NeuronBones.LeftHand); _body.LeftArm.wrist.Rotation = Quaternion.Euler(_actor.GetReceivedRotation(NeuronBones.LeftHand)); _body.RightArm.shoulder.Position = _actor.GetReceivedPosition(NeuronBones.RightShoulder); _body.RightArm.shoulder.Rotation = Quaternion.Euler(_actor.GetReceivedRotation(NeuronBones.RightShoulder)); _body.RightArm.Clavicle.Position = _actor.GetReceivedPosition(NeuronBones.RightArm); _body.RightArm.Clavicle.Rotation = Quaternion.Euler(_actor.GetReceivedRotation(NeuronBones.RightArm)); _body.RightArm.Elbow.Position = _actor.GetReceivedPosition(NeuronBones.RightForeArm); _body.RightArm.Elbow.Rotation = Quaternion.Euler(_actor.GetReceivedRotation(NeuronBones.RightForeArm)); _body.RightArm.wrist.Position = _actor.GetReceivedPosition(NeuronBones.RightHand); _body.RightArm.wrist.Rotation = Quaternion.Euler(_actor.GetReceivedRotation(NeuronBones.RightHand)); _body.LeftLeg.Hip.Position = _actor.GetReceivedPosition(NeuronBones.LeftUpLeg); _body.LeftLeg.Hip.Rotation = Quaternion.Euler(_actor.GetReceivedRotation(NeuronBones.LeftUpLeg)); _body.LeftLeg.knee.Position = _actor.GetReceivedPosition(NeuronBones.LeftLeg); _body.LeftLeg.knee.Rotation = Quaternion.Euler(_actor.GetReceivedRotation(NeuronBones.LeftLeg)); _body.LeftLeg.foot.Position = _actor.GetReceivedPosition(NeuronBones.LeftFoot); _body.LeftLeg.foot.Rotation = Quaternion.Euler(_actor.GetReceivedRotation(NeuronBones.LeftFoot)); _body.RightLeg.Hip.Position = _actor.GetReceivedPosition(NeuronBones.RightUpLeg); _body.RightLeg.Hip.Rotation = Quaternion.Euler(_actor.GetReceivedRotation(NeuronBones.RightUpLeg)); _body.RightLeg.knee.Position = _actor.GetReceivedPosition(NeuronBones.RightLeg); _body.RightLeg.knee.Rotation = Quaternion.Euler(_actor.GetReceivedRotation(NeuronBones.RightLeg)); _body.RightLeg.foot.Position = _actor.GetReceivedPosition(NeuronBones.RightFoot); _body.RightLeg.foot.Rotation = Quaternion.Euler(_actor.GetReceivedRotation(NeuronBones.RightFoot)); Body.Invoke(_body); }
public NeuronAnimatorInstanceBVH(Animator animator, NeuronActor actor) { BoundAnimator = animator; UpdateOffset(); }
public NeuronAnimatorInstance(Animator animator, NeuronActor actor) : base(actor) { boundAnimator = animator; UpdateOffset(); }
// apply transforms extracted from actor mocap data to transforms of animator bones public static void ApplyMotion(NeuronActor actor, Animator animator, Vector3[] positionOffsets, Vector3[] rotationOffsets, bool bFixedUpdateMode, float fLerpPosition, int iFPS, float fLerpDeltaTime) { // apply Hips position SetPosition(animator, HumanBodyBones.Hips, actor.GetReceivedPosition(NeuronBones.Hips) + positionOffsets[(int)HumanBodyBones.Hips], bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.Hips, actor.GetReceivedRotation(NeuronBones.Hips), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); // apply positions if (actor.withDisplacement) { // legs SetPosition(animator, HumanBodyBones.RightUpperLeg, actor.GetReceivedPosition(NeuronBones.RightUpLeg) + positionOffsets[(int)HumanBodyBones.RightUpperLeg], bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.RightLowerLeg, actor.GetReceivedPosition(NeuronBones.RightLeg), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.RightFoot, actor.GetReceivedPosition(NeuronBones.RightFoot), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.LeftUpperLeg, actor.GetReceivedPosition(NeuronBones.LeftUpLeg) + positionOffsets[(int)HumanBodyBones.LeftUpperLeg], bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.LeftLowerLeg, actor.GetReceivedPosition(NeuronBones.LeftLeg), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.LeftFoot, actor.GetReceivedPosition(NeuronBones.LeftFoot), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); // spine SetPosition(animator, HumanBodyBones.Spine, actor.GetReceivedPosition(NeuronBones.Spine), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.Chest, actor.GetReceivedPosition(NeuronBones.Spine3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.Neck, actor.GetReceivedPosition(NeuronBones.Neck), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.Head, actor.GetReceivedPosition(NeuronBones.Head), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); // right arm SetPosition(animator, HumanBodyBones.RightShoulder, actor.GetReceivedPosition(NeuronBones.RightShoulder), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.RightUpperArm, actor.GetReceivedPosition(NeuronBones.RightArm), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.RightLowerArm, actor.GetReceivedPosition(NeuronBones.RightForeArm), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); // right hand SetPosition(animator, HumanBodyBones.RightHand, actor.GetReceivedPosition(NeuronBones.RightHand), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); //SetPosition( animator, HumanBodyBones.RightThumbProximal, actor.GetReceivedPosition( NeuronBones.RightHandThumb1 ), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.RightThumbIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandThumb2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.RightThumbDistal, actor.GetReceivedPosition(NeuronBones.RightHandThumb3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.RightIndexProximal, actor.GetReceivedPosition(NeuronBones.RightHandIndex1), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.RightIndexIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandIndex2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.RightIndexDistal, actor.GetReceivedPosition(NeuronBones.RightHandIndex3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.RightMiddleProximal, actor.GetReceivedPosition(NeuronBones.RightHandMiddle1), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.RightMiddleIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandMiddle2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.RightMiddleDistal, actor.GetReceivedPosition(NeuronBones.RightHandMiddle3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.RightRingProximal, actor.GetReceivedPosition(NeuronBones.RightHandRing1), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.RightRingIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandRing2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.RightRingDistal, actor.GetReceivedPosition(NeuronBones.RightHandRing3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.RightLittleProximal, actor.GetReceivedPosition(NeuronBones.RightHandPinky1), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.RightLittleIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandPinky2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.RightLittleDistal, actor.GetReceivedPosition(NeuronBones.RightHandPinky3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); // left arm SetPosition(animator, HumanBodyBones.LeftShoulder, actor.GetReceivedPosition(NeuronBones.LeftShoulder), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.LeftUpperArm, actor.GetReceivedPosition(NeuronBones.LeftArm), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.LeftLowerArm, actor.GetReceivedPosition(NeuronBones.LeftForeArm), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); // left hand SetPosition(animator, HumanBodyBones.LeftHand, actor.GetReceivedPosition(NeuronBones.LeftHand), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); //SetPosition( animator, HumanBodyBones.LeftThumbProximal, actor.GetReceivedPosition( NeuronBones.LeftHandThumb1 ), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.LeftThumbIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandThumb2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.LeftThumbDistal, actor.GetReceivedPosition(NeuronBones.LeftHandThumb3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.LeftIndexProximal, actor.GetReceivedPosition(NeuronBones.LeftHandIndex1), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.LeftIndexIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandIndex2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.LeftIndexDistal, actor.GetReceivedPosition(NeuronBones.LeftHandIndex3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.LeftMiddleProximal, actor.GetReceivedPosition(NeuronBones.LeftHandMiddle1), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.LeftMiddleIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandMiddle2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.LeftMiddleDistal, actor.GetReceivedPosition(NeuronBones.LeftHandMiddle3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.LeftRingProximal, actor.GetReceivedPosition(NeuronBones.LeftHandRing1), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.LeftRingIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandRing2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.LeftRingDistal, actor.GetReceivedPosition(NeuronBones.LeftHandRing3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.LeftLittleProximal, actor.GetReceivedPosition(NeuronBones.LeftHandPinky1), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.LeftLittleIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandPinky2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetPosition(animator, HumanBodyBones.LeftLittleDistal, actor.GetReceivedPosition(NeuronBones.LeftHandPinky3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); } // apply rotations // legs SetRotation(animator, HumanBodyBones.RightUpperLeg, actor.GetReceivedRotation(NeuronBones.RightUpLeg), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.RightLowerLeg, actor.GetReceivedRotation(NeuronBones.RightLeg), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.RightFoot, actor.GetReceivedRotation(NeuronBones.RightFoot), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftUpperLeg, actor.GetReceivedRotation(NeuronBones.LeftUpLeg), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftLowerLeg, actor.GetReceivedRotation(NeuronBones.LeftLeg), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftFoot, actor.GetReceivedRotation(NeuronBones.LeftFoot), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); // spine SetRotation(animator, HumanBodyBones.Spine, actor.GetReceivedRotation(NeuronBones.Spine), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.Chest, actor.GetReceivedRotation(NeuronBones.Spine1) + actor.GetReceivedRotation(NeuronBones.Spine2) + actor.GetReceivedRotation(NeuronBones.Spine3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.Neck, actor.GetReceivedRotation(NeuronBones.Neck), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.Head, actor.GetReceivedRotation(NeuronBones.Head), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); // right arm SetRotation(animator, HumanBodyBones.RightShoulder, actor.GetReceivedRotation(NeuronBones.RightShoulder), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.RightUpperArm, actor.GetReceivedRotation(NeuronBones.RightArm), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.RightLowerArm, actor.GetReceivedRotation(NeuronBones.RightForeArm), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); // right hand SetRotation(animator, HumanBodyBones.RightHand, actor.GetReceivedRotation(NeuronBones.RightHand), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.RightThumbProximal, actor.GetReceivedRotation(NeuronBones.RightHandThumb1) /* + new Vector3(0.0f, 50.0f, 0.0f)*/, bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.RightThumbIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandThumb2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.RightThumbDistal, actor.GetReceivedRotation(NeuronBones.RightHandThumb3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.RightIndexProximal, actor.GetReceivedRotation(NeuronBones.RightHandIndex1) + actor.GetReceivedRotation(NeuronBones.RightInHandIndex), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.RightIndexIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandIndex2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.RightIndexDistal, actor.GetReceivedRotation(NeuronBones.RightHandIndex3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.RightMiddleProximal, actor.GetReceivedRotation(NeuronBones.RightHandMiddle1) + actor.GetReceivedRotation(NeuronBones.RightInHandMiddle), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.RightMiddleIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandMiddle2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.RightMiddleDistal, actor.GetReceivedRotation(NeuronBones.RightHandMiddle3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.RightRingProximal, actor.GetReceivedRotation(NeuronBones.RightHandRing1) + actor.GetReceivedRotation(NeuronBones.RightInHandRing), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.RightRingIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandRing2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.RightRingDistal, actor.GetReceivedRotation(NeuronBones.RightHandRing3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.RightLittleProximal, actor.GetReceivedRotation(NeuronBones.RightHandPinky1) + actor.GetReceivedRotation(NeuronBones.RightInHandPinky), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.RightLittleIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandPinky2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.RightLittleDistal, actor.GetReceivedRotation(NeuronBones.RightHandPinky3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); // left arm SetRotation(animator, HumanBodyBones.LeftShoulder, actor.GetReceivedRotation(NeuronBones.LeftShoulder), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftUpperArm, actor.GetReceivedRotation(NeuronBones.LeftArm), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftLowerArm, actor.GetReceivedRotation(NeuronBones.LeftForeArm), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); // left hand SetRotation(animator, HumanBodyBones.LeftHand, actor.GetReceivedRotation(NeuronBones.LeftHand), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftThumbProximal, actor.GetReceivedRotation(NeuronBones.LeftHandThumb1) /* + new Vector3(0.0f, -50.0f, 0.0f)*/, bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftThumbIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandThumb2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftThumbDistal, actor.GetReceivedRotation(NeuronBones.LeftHandThumb3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftIndexProximal, actor.GetReceivedRotation(NeuronBones.LeftHandIndex1) + actor.GetReceivedRotation(NeuronBones.LeftInHandIndex), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftIndexIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandIndex2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftIndexDistal, actor.GetReceivedRotation(NeuronBones.LeftHandIndex3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftMiddleProximal, actor.GetReceivedRotation(NeuronBones.LeftHandMiddle1) + actor.GetReceivedRotation(NeuronBones.LeftInHandMiddle), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftMiddleIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandMiddle2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftMiddleDistal, actor.GetReceivedRotation(NeuronBones.LeftHandMiddle3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftRingProximal, actor.GetReceivedRotation(NeuronBones.LeftHandRing1) + actor.GetReceivedRotation(NeuronBones.LeftInHandRing), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftRingIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandRing2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftRingDistal, actor.GetReceivedRotation(NeuronBones.LeftHandRing3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftLittleProximal, actor.GetReceivedRotation(NeuronBones.LeftHandPinky1) + actor.GetReceivedRotation(NeuronBones.LeftInHandPinky), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftLittleIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandPinky2), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); SetRotation(animator, HumanBodyBones.LeftLittleDistal, actor.GetReceivedRotation(NeuronBones.LeftHandPinky3), bFixedUpdateMode, fLerpPosition, iFPS, fLerpDeltaTime); }
// apply transforms extracted from actor mocap data to transforms of animator bones public void ApplyMotion(NeuronActor actor, Animator animator, Vector3[] positionOffsets, Vector3[] rotationOffsets) { // apply Hips position if (enableHipsMovement) { SetPosition(animator, HumanBodyBones.Hips, actor.GetReceivedPosition(NeuronBones.Hips) + positionOffsets [(int)HumanBodyBones.Hips]); SetRotation(animator, HumanBodyBones.Hips, actor.GetReceivedRotation(NeuronBones.Hips)); } // apply positions if (actor.withDisplacement) { // legs SetPosition(animator, HumanBodyBones.RightUpperLeg, actor.GetReceivedPosition(NeuronBones.RightUpLeg) + positionOffsets[(int)HumanBodyBones.RightUpperLeg]); SetPosition(animator, HumanBodyBones.RightLowerLeg, actor.GetReceivedPosition(NeuronBones.RightLeg)); SetPosition(animator, HumanBodyBones.RightFoot, actor.GetReceivedPosition(NeuronBones.RightFoot)); SetPosition(animator, HumanBodyBones.LeftUpperLeg, actor.GetReceivedPosition(NeuronBones.LeftUpLeg) + positionOffsets[(int)HumanBodyBones.LeftUpperLeg]); SetPosition(animator, HumanBodyBones.LeftLowerLeg, actor.GetReceivedPosition(NeuronBones.LeftLeg)); SetPosition(animator, HumanBodyBones.LeftFoot, actor.GetReceivedPosition(NeuronBones.LeftFoot)); // spine SetPosition(animator, HumanBodyBones.Spine, actor.GetReceivedPosition(NeuronBones.Spine)); if (useNewRig) { SetPosition(animator, HumanBodyBones.Chest, actor.GetReceivedPosition(NeuronBones.Spine1) ); #if UNITY_2018_2_OR_NEWER SetPosition(animator, HumanBodyBones.UpperChest, actor.GetReceivedPosition(NeuronBones.Spine2) ); #endif SetPosition(animator, HumanBodyBones.Neck, actor.GetReceivedPosition((NeuronBones)NeuronBonesV2.Neck) + (EulerToQuaternion(actor.GetReceivedRotation((NeuronBones)NeuronBonesV2.Neck)) * actor.GetReceivedPosition((NeuronBones)NeuronBonesV2.Neck1)) ); } else { SetPosition(animator, HumanBodyBones.Chest, actor.GetReceivedPosition(NeuronBones.Spine3)); SetPosition(animator, HumanBodyBones.Neck, actor.GetReceivedPosition(NeuronBones.Neck)); } SetPosition(animator, HumanBodyBones.Head, actor.GetReceivedPosition(NeuronBones.Head)); // right arm SetPosition(animator, HumanBodyBones.RightShoulder, actor.GetReceivedPosition(NeuronBones.RightShoulder)); SetPosition(animator, HumanBodyBones.RightUpperArm, actor.GetReceivedPosition(NeuronBones.RightArm)); SetPosition(animator, HumanBodyBones.RightLowerArm, actor.GetReceivedPosition(NeuronBones.RightForeArm)); // right hand SetPosition(animator, HumanBodyBones.RightHand, actor.GetReceivedPosition(NeuronBones.RightHand)); SetPosition(animator, HumanBodyBones.RightThumbProximal, actor.GetReceivedPosition(NeuronBones.RightHandThumb1)); SetPosition(animator, HumanBodyBones.RightThumbIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandThumb2)); SetPosition(animator, HumanBodyBones.RightThumbDistal, actor.GetReceivedPosition(NeuronBones.RightHandThumb3)); SetPosition(animator, HumanBodyBones.RightIndexProximal, actor.GetReceivedPosition(NeuronBones.RightHandIndex1)); SetPosition(animator, HumanBodyBones.RightIndexIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandIndex2)); SetPosition(animator, HumanBodyBones.RightIndexDistal, actor.GetReceivedPosition(NeuronBones.RightHandIndex3)); SetPosition(animator, HumanBodyBones.RightMiddleProximal, actor.GetReceivedPosition(NeuronBones.RightHandMiddle1)); SetPosition(animator, HumanBodyBones.RightMiddleIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandMiddle2)); SetPosition(animator, HumanBodyBones.RightMiddleDistal, actor.GetReceivedPosition(NeuronBones.RightHandMiddle3)); SetPosition(animator, HumanBodyBones.RightRingProximal, actor.GetReceivedPosition(NeuronBones.RightHandRing1)); SetPosition(animator, HumanBodyBones.RightRingIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandRing2)); SetPosition(animator, HumanBodyBones.RightRingDistal, actor.GetReceivedPosition(NeuronBones.RightHandRing3)); SetPosition(animator, HumanBodyBones.RightLittleProximal, actor.GetReceivedPosition(NeuronBones.RightHandPinky1)); SetPosition(animator, HumanBodyBones.RightLittleIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandPinky2)); SetPosition(animator, HumanBodyBones.RightLittleDistal, actor.GetReceivedPosition(NeuronBones.RightHandPinky3)); // left arm SetPosition(animator, HumanBodyBones.LeftShoulder, actor.GetReceivedPosition(NeuronBones.LeftShoulder)); SetPosition(animator, HumanBodyBones.LeftUpperArm, actor.GetReceivedPosition(NeuronBones.LeftArm)); SetPosition(animator, HumanBodyBones.LeftLowerArm, actor.GetReceivedPosition(NeuronBones.LeftForeArm)); // left hand SetPosition(animator, HumanBodyBones.LeftHand, actor.GetReceivedPosition(NeuronBones.LeftHand)); SetPosition(animator, HumanBodyBones.LeftThumbProximal, actor.GetReceivedPosition(NeuronBones.LeftHandThumb1)); SetPosition(animator, HumanBodyBones.LeftThumbIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandThumb2)); SetPosition(animator, HumanBodyBones.LeftThumbDistal, actor.GetReceivedPosition(NeuronBones.LeftHandThumb3)); SetPosition(animator, HumanBodyBones.LeftIndexProximal, actor.GetReceivedPosition(NeuronBones.LeftHandIndex1)); SetPosition(animator, HumanBodyBones.LeftIndexIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandIndex2)); SetPosition(animator, HumanBodyBones.LeftIndexDistal, actor.GetReceivedPosition(NeuronBones.LeftHandIndex3)); SetPosition(animator, HumanBodyBones.LeftMiddleProximal, actor.GetReceivedPosition(NeuronBones.LeftHandMiddle1)); SetPosition(animator, HumanBodyBones.LeftMiddleIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandMiddle2)); SetPosition(animator, HumanBodyBones.LeftMiddleDistal, actor.GetReceivedPosition(NeuronBones.LeftHandMiddle3)); SetPosition(animator, HumanBodyBones.LeftRingProximal, actor.GetReceivedPosition(NeuronBones.LeftHandRing1)); SetPosition(animator, HumanBodyBones.LeftRingIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandRing2)); SetPosition(animator, HumanBodyBones.LeftRingDistal, actor.GetReceivedPosition(NeuronBones.LeftHandRing3)); SetPosition(animator, HumanBodyBones.LeftLittleProximal, actor.GetReceivedPosition(NeuronBones.LeftHandPinky1)); SetPosition(animator, HumanBodyBones.LeftLittleIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandPinky2)); SetPosition(animator, HumanBodyBones.LeftLittleDistal, actor.GetReceivedPosition(NeuronBones.LeftHandPinky3)); } // apply rotations // legs SetRotation(animator, HumanBodyBones.RightUpperLeg, actor.GetReceivedRotation(NeuronBones.RightUpLeg)); SetRotation(animator, HumanBodyBones.RightLowerLeg, actor.GetReceivedRotation(NeuronBones.RightLeg)); SetRotation(animator, HumanBodyBones.RightFoot, actor.GetReceivedRotation(NeuronBones.RightFoot)); SetRotation(animator, HumanBodyBones.LeftUpperLeg, actor.GetReceivedRotation(NeuronBones.LeftUpLeg)); SetRotation(animator, HumanBodyBones.LeftLowerLeg, actor.GetReceivedRotation(NeuronBones.LeftLeg)); SetRotation(animator, HumanBodyBones.LeftFoot, actor.GetReceivedRotation(NeuronBones.LeftFoot)); // spine SetRotation(animator, HumanBodyBones.Spine, actor.GetReceivedRotation(NeuronBones.Spine)); //SetRotation( animator, HumanBodyBones.Chest, actor.GetReceivedRotation( NeuronBones.Spine1 ) + actor.GetReceivedRotation( NeuronBones.Spine2 ) + actor.GetReceivedRotation( NeuronBones.Spine3 ) ); if (useNewRig) { SetRotation(animator, HumanBodyBones.Chest, (EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.Spine1)) * EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.Spine2))).eulerAngles ); SetRotation(animator, HumanBodyBones.Neck, (EulerToQuaternion(actor.GetReceivedRotation((NeuronBones)NeuronBonesV2.Neck)) * EulerToQuaternion(actor.GetReceivedRotation((NeuronBones)NeuronBonesV2.Neck1))).eulerAngles ); } else { SetRotation(animator, HumanBodyBones.Chest, (EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.Spine1)) * EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.Spine2)) * EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.Spine3))).eulerAngles ); SetRotation(animator, HumanBodyBones.Neck, actor.GetReceivedRotation(NeuronBones.Neck)); } SetRotation(animator, HumanBodyBones.Head, actor.GetReceivedRotation(NeuronBones.Head)); // right arm SetRotation(animator, HumanBodyBones.RightShoulder, actor.GetReceivedRotation(NeuronBones.RightShoulder)); SetRotation(animator, HumanBodyBones.RightUpperArm, actor.GetReceivedRotation(NeuronBones.RightArm)); SetRotation(animator, HumanBodyBones.RightLowerArm, actor.GetReceivedRotation(NeuronBones.RightForeArm)); // right hand SetRotation(animator, HumanBodyBones.RightHand, actor.GetReceivedRotation(NeuronBones.RightHand)); SetRotation(animator, HumanBodyBones.RightThumbProximal, actor.GetReceivedRotation(NeuronBones.RightHandThumb1)); SetRotation(animator, HumanBodyBones.RightThumbIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandThumb2)); SetRotation(animator, HumanBodyBones.RightThumbDistal, actor.GetReceivedRotation(NeuronBones.RightHandThumb3)); //SetRotation( animator, HumanBodyBones.RightIndexProximal, actor.GetReceivedRotation( NeuronBones.RightHandIndex1 ) + actor.GetReceivedRotation( NeuronBones.RightInHandIndex ) ); SetRotation(animator, HumanBodyBones.RightIndexProximal, (EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.RightInHandIndex)) * EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.RightHandIndex1))).eulerAngles ); SetRotation(animator, HumanBodyBones.RightIndexIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandIndex2)); SetRotation(animator, HumanBodyBones.RightIndexDistal, actor.GetReceivedRotation(NeuronBones.RightHandIndex3)); //SetRotation( animator, HumanBodyBones.RightMiddleProximal, actor.GetReceivedRotation( NeuronBones.RightHandMiddle1 ) + actor.GetReceivedRotation( NeuronBones.RightInHandMiddle ) ); SetRotation(animator, HumanBodyBones.RightMiddleProximal, (EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.RightInHandMiddle)) * EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.RightHandMiddle1))).eulerAngles ); SetRotation(animator, HumanBodyBones.RightMiddleIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandMiddle2)); SetRotation(animator, HumanBodyBones.RightMiddleDistal, actor.GetReceivedRotation(NeuronBones.RightHandMiddle3)); //SetRotation( animator, HumanBodyBones.RightRingProximal, actor.GetReceivedRotation( NeuronBones.RightHandRing1 ) + actor.GetReceivedRotation( NeuronBones.RightInHandRing ) ); SetRotation(animator, HumanBodyBones.RightRingProximal, (EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.RightInHandRing)) * EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.RightHandRing1))).eulerAngles ); SetRotation(animator, HumanBodyBones.RightRingIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandRing2)); SetRotation(animator, HumanBodyBones.RightRingDistal, actor.GetReceivedRotation(NeuronBones.RightHandRing3)); //SetRotation( animator, HumanBodyBones.RightLittleProximal, actor.GetReceivedRotation( NeuronBones.RightHandPinky1 ) + actor.GetReceivedRotation( NeuronBones.RightInHandPinky ) ); SetRotation(animator, HumanBodyBones.RightLittleProximal, (EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.RightInHandPinky)) * EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.RightHandPinky1))).eulerAngles ); SetRotation(animator, HumanBodyBones.RightLittleIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandPinky2)); SetRotation(animator, HumanBodyBones.RightLittleDistal, actor.GetReceivedRotation(NeuronBones.RightHandPinky3)); // left arm SetRotation(animator, HumanBodyBones.LeftShoulder, actor.GetReceivedRotation(NeuronBones.LeftShoulder)); SetRotation(animator, HumanBodyBones.LeftUpperArm, actor.GetReceivedRotation(NeuronBones.LeftArm)); SetRotation(animator, HumanBodyBones.LeftLowerArm, actor.GetReceivedRotation(NeuronBones.LeftForeArm)); // left hand SetRotation(animator, HumanBodyBones.LeftHand, actor.GetReceivedRotation(NeuronBones.LeftHand)); SetRotation(animator, HumanBodyBones.LeftThumbProximal, actor.GetReceivedRotation(NeuronBones.LeftHandThumb1)); SetRotation(animator, HumanBodyBones.LeftThumbIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandThumb2)); SetRotation(animator, HumanBodyBones.LeftThumbDistal, actor.GetReceivedRotation(NeuronBones.LeftHandThumb3)); //SetRotation( animator, HumanBodyBones.LeftIndexProximal, actor.GetReceivedRotation( NeuronBones.LeftHandIndex1 ) + actor.GetReceivedRotation( NeuronBones.LeftInHandIndex ) ); SetRotation(animator, HumanBodyBones.LeftIndexProximal, (EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.LeftInHandIndex)) * EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.LeftHandIndex1))).eulerAngles ); SetRotation(animator, HumanBodyBones.LeftIndexIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandIndex2)); SetRotation(animator, HumanBodyBones.LeftIndexDistal, actor.GetReceivedRotation(NeuronBones.LeftHandIndex3)); //SetRotation( animator, HumanBodyBones.LeftMiddleProximal, actor.GetReceivedRotation( NeuronBones.LeftHandMiddle1 ) + actor.GetReceivedRotation( NeuronBones.LeftInHandMiddle ) ); SetRotation(animator, HumanBodyBones.LeftMiddleProximal, (EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.LeftInHandMiddle)) * EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.LeftHandMiddle1))).eulerAngles ); SetRotation(animator, HumanBodyBones.LeftMiddleIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandMiddle2)); SetRotation(animator, HumanBodyBones.LeftMiddleDistal, actor.GetReceivedRotation(NeuronBones.LeftHandMiddle3)); //SetRotation( animator, HumanBodyBones.LeftRingProximal, actor.GetReceivedRotation( NeuronBones.LeftHandRing1 ) + actor.GetReceivedRotation( NeuronBones.LeftInHandRing ) ); SetRotation(animator, HumanBodyBones.LeftRingProximal, (EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.LeftInHandRing)) * EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.LeftHandRing1))).eulerAngles ); SetRotation(animator, HumanBodyBones.LeftRingIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandRing2)); SetRotation(animator, HumanBodyBones.LeftRingDistal, actor.GetReceivedRotation(NeuronBones.LeftHandRing3)); //SetRotation( animator, HumanBodyBones.LeftLittleProximal, actor.GetReceivedRotation( NeuronBones.LeftHandPinky1 ) + actor.GetReceivedRotation( NeuronBones.LeftInHandPinky ) ); SetRotation(animator, HumanBodyBones.LeftLittleProximal, (EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.LeftInHandPinky)) * EulerToQuaternion(actor.GetReceivedRotation(NeuronBones.LeftHandPinky1))).eulerAngles ); SetRotation(animator, HumanBodyBones.LeftLittleIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandPinky2)); SetRotation(animator, HumanBodyBones.LeftLittleDistal, actor.GetReceivedRotation(NeuronBones.LeftHandPinky3)); }
public NeuronTransformsInstanceVR(NeuronActor actor) : base(actor) { }
public NeuronAnimatorInstance(NeuronActor actor) : base(actor) { }
// apply transforms extracted from actor mocap data to transforms of animator bones public static void ApplyMotion(NeuronActor actor, Animator animator, ref int last_evaluate_time, Vector3[] positionOffsets, Vector3[] rotationOffsets) { float swap_ratio = CalculateSwapRatio(actor.timeStamp, ref last_evaluate_time); if (swap_ratio <= 0.0f) { return; } // apply Hips position SetPosition(animator, HumanBodyBones.Hips, actor.GetReceivedPosition(NeuronBones.Hips) + positionOffsets[(int)HumanBodyBones.Hips], swap_ratio); SetRotation(animator, HumanBodyBones.Hips, actor.GetReceivedRotation(NeuronBones.Hips), swap_ratio); // apply positions if (actor.withDisplacement) { // legs SetPosition(animator, HumanBodyBones.RightUpperLeg, actor.GetReceivedPosition(NeuronBones.RightUpLeg) + positionOffsets[(int)HumanBodyBones.RightUpperLeg], swap_ratio); SetPosition(animator, HumanBodyBones.RightLowerLeg, actor.GetReceivedPosition(NeuronBones.RightLeg), swap_ratio); SetPosition(animator, HumanBodyBones.RightFoot, actor.GetReceivedPosition(NeuronBones.RightFoot), swap_ratio); SetPosition(animator, HumanBodyBones.LeftUpperLeg, actor.GetReceivedPosition(NeuronBones.LeftUpLeg) + positionOffsets[(int)HumanBodyBones.LeftUpperLeg], swap_ratio); SetPosition(animator, HumanBodyBones.LeftLowerLeg, actor.GetReceivedPosition(NeuronBones.LeftLeg), swap_ratio); SetPosition(animator, HumanBodyBones.LeftFoot, actor.GetReceivedPosition(NeuronBones.LeftFoot), swap_ratio); // spine SetPosition(animator, HumanBodyBones.Spine, actor.GetReceivedPosition(NeuronBones.Spine), swap_ratio); SetPosition(animator, HumanBodyBones.Chest, actor.GetReceivedPosition(NeuronBones.Spine3), swap_ratio); SetPosition(animator, HumanBodyBones.Neck, actor.GetReceivedPosition(NeuronBones.Neck), swap_ratio); SetPosition(animator, HumanBodyBones.Head, actor.GetReceivedPosition(NeuronBones.Head), swap_ratio); // right arm SetPosition(animator, HumanBodyBones.RightShoulder, actor.GetReceivedPosition(NeuronBones.RightShoulder), swap_ratio); SetPosition(animator, HumanBodyBones.RightUpperArm, actor.GetReceivedPosition(NeuronBones.RightArm), swap_ratio); SetPosition(animator, HumanBodyBones.RightLowerArm, actor.GetReceivedPosition(NeuronBones.RightForeArm), swap_ratio); // right hand SetPosition(animator, HumanBodyBones.RightHand, actor.GetReceivedPosition(NeuronBones.RightHand), swap_ratio); SetPosition(animator, HumanBodyBones.RightThumbProximal, actor.GetReceivedPosition(NeuronBones.RightHandThumb1), swap_ratio); SetPosition(animator, HumanBodyBones.RightThumbIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandThumb2), swap_ratio); SetPosition(animator, HumanBodyBones.RightThumbDistal, actor.GetReceivedPosition(NeuronBones.RightHandThumb3), swap_ratio); SetPosition(animator, HumanBodyBones.RightIndexProximal, actor.GetReceivedPosition(NeuronBones.RightHandIndex1), swap_ratio); SetPosition(animator, HumanBodyBones.RightIndexIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandIndex2), swap_ratio); SetPosition(animator, HumanBodyBones.RightIndexDistal, actor.GetReceivedPosition(NeuronBones.RightHandIndex3), swap_ratio); SetPosition(animator, HumanBodyBones.RightMiddleProximal, actor.GetReceivedPosition(NeuronBones.RightHandMiddle1), swap_ratio); SetPosition(animator, HumanBodyBones.RightMiddleIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandMiddle2), swap_ratio); SetPosition(animator, HumanBodyBones.RightMiddleDistal, actor.GetReceivedPosition(NeuronBones.RightHandMiddle3), swap_ratio); SetPosition(animator, HumanBodyBones.RightRingProximal, actor.GetReceivedPosition(NeuronBones.RightHandRing1), swap_ratio); SetPosition(animator, HumanBodyBones.RightRingIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandRing2), swap_ratio); SetPosition(animator, HumanBodyBones.RightRingDistal, actor.GetReceivedPosition(NeuronBones.RightHandRing3), swap_ratio); SetPosition(animator, HumanBodyBones.RightLittleProximal, actor.GetReceivedPosition(NeuronBones.RightHandPinky1), swap_ratio); SetPosition(animator, HumanBodyBones.RightLittleIntermediate, actor.GetReceivedPosition(NeuronBones.RightHandPinky2), swap_ratio); SetPosition(animator, HumanBodyBones.RightLittleDistal, actor.GetReceivedPosition(NeuronBones.RightHandPinky3), swap_ratio); // left arm SetPosition(animator, HumanBodyBones.LeftShoulder, actor.GetReceivedPosition(NeuronBones.LeftShoulder), swap_ratio); SetPosition(animator, HumanBodyBones.LeftUpperArm, actor.GetReceivedPosition(NeuronBones.LeftArm), swap_ratio); SetPosition(animator, HumanBodyBones.LeftLowerArm, actor.GetReceivedPosition(NeuronBones.LeftForeArm), swap_ratio); // left hand SetPosition(animator, HumanBodyBones.LeftHand, actor.GetReceivedPosition(NeuronBones.LeftHand), swap_ratio); SetPosition(animator, HumanBodyBones.LeftThumbProximal, actor.GetReceivedPosition(NeuronBones.LeftHandThumb1), swap_ratio); SetPosition(animator, HumanBodyBones.LeftThumbIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandThumb2), swap_ratio); SetPosition(animator, HumanBodyBones.LeftThumbDistal, actor.GetReceivedPosition(NeuronBones.LeftHandThumb3), swap_ratio); SetPosition(animator, HumanBodyBones.LeftIndexProximal, actor.GetReceivedPosition(NeuronBones.LeftHandIndex1), swap_ratio); SetPosition(animator, HumanBodyBones.LeftIndexIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandIndex2), swap_ratio); SetPosition(animator, HumanBodyBones.LeftIndexDistal, actor.GetReceivedPosition(NeuronBones.LeftHandIndex3), swap_ratio); SetPosition(animator, HumanBodyBones.LeftMiddleProximal, actor.GetReceivedPosition(NeuronBones.LeftHandMiddle1), swap_ratio); SetPosition(animator, HumanBodyBones.LeftMiddleIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandMiddle2), swap_ratio); SetPosition(animator, HumanBodyBones.LeftMiddleDistal, actor.GetReceivedPosition(NeuronBones.LeftHandMiddle3), swap_ratio); SetPosition(animator, HumanBodyBones.LeftRingProximal, actor.GetReceivedPosition(NeuronBones.LeftHandRing1), swap_ratio); SetPosition(animator, HumanBodyBones.LeftRingIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandRing2), swap_ratio); SetPosition(animator, HumanBodyBones.LeftRingDistal, actor.GetReceivedPosition(NeuronBones.LeftHandRing3), swap_ratio); SetPosition(animator, HumanBodyBones.LeftLittleProximal, actor.GetReceivedPosition(NeuronBones.LeftHandPinky1), swap_ratio); SetPosition(animator, HumanBodyBones.LeftLittleIntermediate, actor.GetReceivedPosition(NeuronBones.LeftHandPinky2), swap_ratio); SetPosition(animator, HumanBodyBones.LeftLittleDistal, actor.GetReceivedPosition(NeuronBones.LeftHandPinky3), swap_ratio); } // apply rotations // legs SetRotation(animator, HumanBodyBones.RightUpperLeg, actor.GetReceivedRotation(NeuronBones.RightUpLeg), swap_ratio); SetRotation(animator, HumanBodyBones.RightLowerLeg, actor.GetReceivedRotation(NeuronBones.RightLeg), swap_ratio); SetRotation(animator, HumanBodyBones.RightFoot, actor.GetReceivedRotation(NeuronBones.RightFoot), swap_ratio); SetRotation(animator, HumanBodyBones.LeftUpperLeg, actor.GetReceivedRotation(NeuronBones.LeftUpLeg), swap_ratio); SetRotation(animator, HumanBodyBones.LeftLowerLeg, actor.GetReceivedRotation(NeuronBones.LeftLeg), swap_ratio); SetRotation(animator, HumanBodyBones.LeftFoot, actor.GetReceivedRotation(NeuronBones.LeftFoot), swap_ratio); // spine SetRotation(animator, HumanBodyBones.Spine, actor.GetReceivedRotation(NeuronBones.Spine), swap_ratio); SetRotation(animator, HumanBodyBones.Chest, actor.GetReceivedRotation(NeuronBones.Spine1) + actor.GetReceivedRotation(NeuronBones.Spine2) + actor.GetReceivedRotation(NeuronBones.Spine3), swap_ratio); SetRotation(animator, HumanBodyBones.Neck, actor.GetReceivedRotation(NeuronBones.Neck), swap_ratio); SetRotation(animator, HumanBodyBones.Head, actor.GetReceivedRotation(NeuronBones.Head), swap_ratio); // right arm SetRotation(animator, HumanBodyBones.RightShoulder, actor.GetReceivedRotation(NeuronBones.RightShoulder), swap_ratio); SetRotation(animator, HumanBodyBones.RightUpperArm, actor.GetReceivedRotation(NeuronBones.RightArm), swap_ratio); SetRotation(animator, HumanBodyBones.RightLowerArm, actor.GetReceivedRotation(NeuronBones.RightForeArm), swap_ratio); // right hand SetRotation(animator, HumanBodyBones.RightHand, actor.GetReceivedRotation(NeuronBones.RightHand), swap_ratio); SetRotation(animator, HumanBodyBones.RightThumbProximal, actor.GetReceivedRotation(NeuronBones.RightHandThumb1), swap_ratio); SetRotation(animator, HumanBodyBones.RightThumbIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandThumb2), swap_ratio); SetRotation(animator, HumanBodyBones.RightThumbDistal, actor.GetReceivedRotation(NeuronBones.RightHandThumb3), swap_ratio); SetRotation(animator, HumanBodyBones.RightIndexProximal, actor.GetReceivedRotation(NeuronBones.RightHandIndex1) + actor.GetReceivedRotation(NeuronBones.RightInHandIndex), swap_ratio); SetRotation(animator, HumanBodyBones.RightIndexIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandIndex2), swap_ratio); SetRotation(animator, HumanBodyBones.RightIndexDistal, actor.GetReceivedRotation(NeuronBones.RightHandIndex3), swap_ratio); SetRotation(animator, HumanBodyBones.RightMiddleProximal, actor.GetReceivedRotation(NeuronBones.RightHandMiddle1) + actor.GetReceivedRotation(NeuronBones.RightInHandMiddle), swap_ratio); SetRotation(animator, HumanBodyBones.RightMiddleIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandMiddle2), swap_ratio); SetRotation(animator, HumanBodyBones.RightMiddleDistal, actor.GetReceivedRotation(NeuronBones.RightHandMiddle3), swap_ratio); SetRotation(animator, HumanBodyBones.RightRingProximal, actor.GetReceivedRotation(NeuronBones.RightHandRing1) + actor.GetReceivedRotation(NeuronBones.RightInHandRing), swap_ratio); SetRotation(animator, HumanBodyBones.RightRingIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandRing2), swap_ratio); SetRotation(animator, HumanBodyBones.RightRingDistal, actor.GetReceivedRotation(NeuronBones.RightHandRing3), swap_ratio); SetRotation(animator, HumanBodyBones.RightLittleProximal, actor.GetReceivedRotation(NeuronBones.RightHandPinky1) + actor.GetReceivedRotation(NeuronBones.RightInHandPinky), swap_ratio); SetRotation(animator, HumanBodyBones.RightLittleIntermediate, actor.GetReceivedRotation(NeuronBones.RightHandPinky2), swap_ratio); SetRotation(animator, HumanBodyBones.RightLittleDistal, actor.GetReceivedRotation(NeuronBones.RightHandPinky3), swap_ratio); // left arm SetRotation(animator, HumanBodyBones.LeftShoulder, actor.GetReceivedRotation(NeuronBones.LeftShoulder), swap_ratio); SetRotation(animator, HumanBodyBones.LeftUpperArm, actor.GetReceivedRotation(NeuronBones.LeftArm), swap_ratio); SetRotation(animator, HumanBodyBones.LeftLowerArm, actor.GetReceivedRotation(NeuronBones.LeftForeArm), swap_ratio); // left hand SetRotation(animator, HumanBodyBones.LeftHand, actor.GetReceivedRotation(NeuronBones.LeftHand), swap_ratio); SetRotation(animator, HumanBodyBones.LeftThumbProximal, actor.GetReceivedRotation(NeuronBones.LeftHandThumb1), swap_ratio); SetRotation(animator, HumanBodyBones.LeftThumbIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandThumb2), swap_ratio); SetRotation(animator, HumanBodyBones.LeftThumbDistal, actor.GetReceivedRotation(NeuronBones.LeftHandThumb3), swap_ratio); SetRotation(animator, HumanBodyBones.LeftIndexProximal, actor.GetReceivedRotation(NeuronBones.LeftHandIndex1) + actor.GetReceivedRotation(NeuronBones.LeftInHandIndex), swap_ratio); SetRotation(animator, HumanBodyBones.LeftIndexIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandIndex2), swap_ratio); SetRotation(animator, HumanBodyBones.LeftIndexDistal, actor.GetReceivedRotation(NeuronBones.LeftHandIndex3), swap_ratio); SetRotation(animator, HumanBodyBones.LeftMiddleProximal, actor.GetReceivedRotation(NeuronBones.LeftHandMiddle1) + actor.GetReceivedRotation(NeuronBones.LeftInHandMiddle), swap_ratio); SetRotation(animator, HumanBodyBones.LeftMiddleIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandMiddle2), swap_ratio); SetRotation(animator, HumanBodyBones.LeftMiddleDistal, actor.GetReceivedRotation(NeuronBones.LeftHandMiddle3), swap_ratio); SetRotation(animator, HumanBodyBones.LeftRingProximal, actor.GetReceivedRotation(NeuronBones.LeftHandRing1) + actor.GetReceivedRotation(NeuronBones.LeftInHandRing), swap_ratio); SetRotation(animator, HumanBodyBones.LeftRingIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandRing2), swap_ratio); SetRotation(animator, HumanBodyBones.LeftRingDistal, actor.GetReceivedRotation(NeuronBones.LeftHandRing3), swap_ratio); SetRotation(animator, HumanBodyBones.LeftLittleProximal, actor.GetReceivedRotation(NeuronBones.LeftHandPinky1) + actor.GetReceivedRotation(NeuronBones.LeftInHandPinky), swap_ratio); SetRotation(animator, HumanBodyBones.LeftLittleIntermediate, actor.GetReceivedRotation(NeuronBones.LeftHandPinky2), swap_ratio); SetRotation(animator, HumanBodyBones.LeftLittleDistal, actor.GetReceivedRotation(NeuronBones.LeftHandPinky3), swap_ratio); }