<commit_before>﻿using UnityEngine;
using System.Collections;

public class TwistBones : MonoBehaviour {
	public float twistValue;
	
	public Transform[] twistBone;
	public Transform[] refBone;
	
	private float[] originalRefRotation;
	private Vector3 rotated;
	
	// Use this for initialization
	void Awake () {
		originalRefRotation = new float[twistBone.Length];
		for(int i = 0; i < twistBone.Length; i++){
			rotated = refBone[i].localRotation * Vector3.up;
			originalRefRotation[i] = Mathf.Atan2(rotated.z, rotated.y) * Mathf.Rad2Deg;
		}
	}
	
	// Update is called once per frame
	void LateUpdate () {
		for(int i = 0; i < twistBone.Length; i++){
			rotated = refBone[i].localRotation * Vector3.up;
			twistBone[i].localEulerAngles = Vector3.zero;
			twistBone[i].Rotate(Vector3.right * twistValue * Mathf.DeltaAngle(originalRefRotation[i], Mathf.Atan2(rotated.z, rotated.y) * Mathf.Rad2Deg));
		}
	}
}<commit_msg>Corrected TwistBones.cs from flipping twistBones 180 degree.<commit_after>﻿using UnityEngine;
using System.Collections;

public class TwistBones : MonoBehaviour {
	public float twistValue;
	
	public Transform[] twistBone;
	public Transform[] refBone;
	
	private float[] originalRefRotation;
	private float[] twistRotation;

	private Vector3 rotated;
	
	// Use this for initialization
	void Awake () {
		originalRefRotation = new float[twistBone.Length];
		twistRotation = new float[twistBone.Length];
		for(int i = 0; i < twistBone.Length; i++){
			rotated = refBone[i].localRotation * Vector3.up;
			originalRefRotation[i] = Mathf.Atan2(rotated.z, rotated.y) * Mathf.Rad2Deg;
		}
	}
	
	// Update is called once per frame
	void LateUpdate () {
		for(int i = 0; i < twistBone.Length; i++){
			rotated = refBone[i].localRotation * Vector3.up;
			float previewsTwist = twistRotation[i];
			twistRotation[i] = Mathf.DeltaAngle(originalRefRotation[i], Mathf.Atan2(rotated.z, rotated.y) * Mathf.Rad2Deg);
			twistBone[i].Rotate(Vector3.right * twistValue * Mathf.DeltaAngle(previewsTwist, twistRotation[i]));
		}
	}
}
{'fraction_non_alphanumeric': 0.1222879684418146, 'fraction_numerical': 0.011834319526627219, 'mean_word_length': 4.604972375690608, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4933897', 'n_tokens_mistral': 766, 'n_tokens_neox': 691, 'n_words': 156}