internal static DynamicBoneCollider[] GetHandColliders(VRCPlayer avatar) { if (avatar.avatarAnimator == null) { return(new DynamicBoneCollider[0]); } Transform boneTransform = avatar.avatarAnimator.GetBoneTransform(HumanBodyBones.LeftHand); DynamicBoneCollider[] array; if (boneTransform == null) { array = null; } else { DynamicBoneCollider[] componentsInChildren = boneTransform.GetComponentsInChildren <DynamicBoneCollider>(true); if (componentsInChildren == null) { array = null; } else { array = (from collider in componentsInChildren where (int)GlobalDynamicBones.bound_f.GetValue(collider) == 0 select collider).ToArray <DynamicBoneCollider>(); } } DynamicBoneCollider[] array2 = array; Transform boneTransform2 = avatar.avatarAnimator.GetBoneTransform(HumanBodyBones.RightHand); DynamicBoneCollider[] array3; if (boneTransform2 == null) { array3 = null; } else { DynamicBoneCollider[] componentsInChildren2 = boneTransform2.GetComponentsInChildren <DynamicBoneCollider>(true); if (componentsInChildren2 == null) { array3 = null; } else { array3 = (from collider in componentsInChildren2 where (int)GlobalDynamicBones.bound_f.GetValue(collider) == 0 select collider).ToArray <DynamicBoneCollider>(); } } DynamicBoneCollider[] array4 = array3; if (array2 == null) { array2 = new DynamicBoneCollider[0]; } if (array4 == null) { array4 = new DynamicBoneCollider[0]; } return(array2.Concat(array4).ToArray <DynamicBoneCollider>()); }
/// <summary> /// 左クリックメニュー /// </summary> /// <param name="rect"></param> private void RightMenu(Rect rect) { GUI.enabled = true; if (Event.current.type == EventType.MouseDown && Event.current.button == 1) { GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent("Copy"), false, () => { dynamicBoneColliderCopy = (DynamicBoneCollider)target; }); if (dynamicBoneColliderCopy == null) { menu.AddDisabledItem(new GUIContent("Paste")); } else { menu.AddItem(new GUIContent("Paste"), false, Paste); } menu.AddSeparator(""); menu.AddItem(new GUIContent("Export"), false, () => { Export(); }); menu.AddSeparator(""); foreach (string boneKey in boneColliderDatas.Keys) { BoneColliderData boneColliderData = boneColliderDatas[boneKey]; menu.AddItem(new GUIContent("Collider/" + boneColliderData.name), false, BoneSettiong, boneColliderData); } menu.ShowAsContext(); } }
/// <summary> /// DynamicBoneColliderBase用 /// </summary> /// <param name="xmlDoc"></param> /// <param name="parent"></param> /// <param name="target"></param> private void SetBoneCollider(XmlDocument xmlDoc, XmlElement parent, DynamicBoneCollider target) { XmlElement mDirection = xmlDoc.CreateElement("m_Direction"); mDirection.InnerText = target.m_Direction.ToString(); XmlElement mCenter = xmlDoc.CreateElement("m_Center"); SetVector3Param(xmlDoc, mCenter, target.m_Center); XmlElement mBound = xmlDoc.CreateElement("m_Bound"); mBound.InnerText = target.m_Bound.ToString(); XmlElement mRadius = xmlDoc.CreateElement("m_Radius"); mRadius.InnerText = target.m_Radius.ToString(); XmlElement mHeight = xmlDoc.CreateElement("m_Height"); mHeight.InnerText = target.m_Height.ToString(); parent.AppendChild(mDirection); parent.AppendChild(mCenter); parent.AppendChild(mBound); parent.AppendChild(mRadius); parent.AppendChild(mHeight); }
public override void Collide(ref Vector3 particlePosition, float particleRadius) { float num1 = this.m_Radius * Mathf.Abs((float)((Component)this).get_transform().get_lossyScale().x); float num2 = this.m_Height * 0.5f - this.m_Radius; if ((double)num2 <= 0.0) { if (this.m_Bound == DynamicBoneColliderBase.Bound.Outside) { DynamicBoneCollider.OutsideSphere(ref particlePosition, particleRadius, ((Component)this).get_transform().TransformPoint(this.m_Center), num1); } else { DynamicBoneCollider.InsideSphere(ref particlePosition, particleRadius, ((Component)this).get_transform().TransformPoint(this.m_Center), num1); } } else { Vector3 center1 = this.m_Center; Vector3 center2 = this.m_Center; switch (this.m_Direction) { case DynamicBoneColliderBase.Direction.X: ref Vector3 local1 = ref center1; local1.x = (__Null)(local1.x - (double)num2); ref Vector3 local2 = ref center2; local2.x = (__Null)(local2.x + (double)num2); break;
/// <summary> /// 設定値の反映 /// </summary> /// <param name="obj"></param> private void BoneSettiong(object obj) { BoneColliderData boneColliderData = (BoneColliderData)obj; DynamicBoneSettingV1 setting = new DynamicBoneSettingV1(); DynamicBoneCollider bone = (DynamicBoneCollider)target; setting.SetXmlToCollider(boneColliderData.filePath, boneColliderData.name, bone); }
/// <summary> /// DynamicBoneCollider変換 /// </summary> /// <param name="targetCollider"></param> /// <param name="colliderData"></param> private void ConvertColliderParamCopy(DynamicBoneCollider targetCollider, XmlNode colliderData) { targetCollider.m_Direction = (DynamicBoneCollider.Direction)Enum.Parse(typeof(DynamicBoneCollider.Direction), colliderData.SelectSingleNode("m_Direction").InnerText); targetCollider.m_Center = ConvertVector3((XmlElement)colliderData.SelectSingleNode("m_Center")); targetCollider.m_Bound = (DynamicBoneCollider.Bound)Enum.Parse(typeof(DynamicBoneCollider.Bound), colliderData.SelectSingleNode("m_Bound").InnerText); targetCollider.m_Radius = float.Parse(colliderData.SelectSingleNode("m_Radius").InnerText); targetCollider.m_Height = float.Parse(colliderData.SelectSingleNode("m_Height").InnerText); }
string PrintCollider(DynamicBoneCollider collider) { return("new DynamicBoneColliderData(" + PrintString(collider.transform.name) + ", " + "DynamicBoneCollider.Direction." + collider.m_Direction + ", " + PrintVector3(collider.m_Center) + ", " + "DynamicBoneCollider.Bound." + collider.m_Bound + ", " + PrintFloat(collider.m_Radius) + ", " + PrintFloat(collider.m_Height) + ")"); }
// DynamicBoneColliderを受け継ぐ private void TakeOverDBC(DynamicBoneCollider sotaiDBC, DynamicBoneCollider resourcesDBC) { // 全ての要素を受け継ぐ sotaiDBC.m_Bound = resourcesDBC.m_Bound; sotaiDBC.m_Center = resourcesDBC.m_Center; sotaiDBC.m_Direction = resourcesDBC.m_Direction; sotaiDBC.m_Height = resourcesDBC.m_Height; sotaiDBC.m_Radius = resourcesDBC.m_Radius; }
public BoobsEditor(CharaPoseController parent, GenericOCITarget target) : base(parent) { this._target = target; this._parent.onLateUpdate += this.LateUpdate; if (_debugLines == null) { _debugLines = new DebugLines(); _debugLines.SetActive(false); } this._leftBoob = this._target.ociChar.charInfo.human.body.bustDynamicBone_L; this._rightBoob = this._target.ociChar.charInfo.human.body.bustDynamicBone_R; DynamicBone_Ver02_LateUpdate_Patches.shouldExecuteLateUpdate += this.ShouldExecuteDynamicBoneLateUpdate; MethodInfo initTransforms = typeof(DynamicBone_Ver02).GetMethod("InitTransforms", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); MethodInfo updateDynamicBones = typeof(DynamicBone_Ver02).GetMethod("UpdateDynamicBones", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); this._leftBoobInitTransforms = (Action)Delegate.CreateDelegate(typeof(Action), this._leftBoob, initTransforms); this._leftBoobUpdateDynamicBones = (Action <float>)Delegate.CreateDelegate(typeof(Action <float>), this._leftBoob, updateDynamicBones); this._rightBoobInitTransforms = (Action)Delegate.CreateDelegate(typeof(Action), this._rightBoob, initTransforms); this._rightBoobUpdateDynamicBones = (Action <float>)Delegate.CreateDelegate(typeof(Action <float>), this._rightBoob, updateDynamicBones); this._dynamicBones = this._parent.GetComponentsInChildren <DynamicBone_Ver02>(true); foreach (KeyValuePair <DynamicBoneColliderBase, CollidersEditor> pair in CollidersEditor._loneColliders) { DynamicBoneCollider normalCollider = pair.Key as DynamicBoneCollider; if (normalCollider == null) { continue; } HashSet <object> ignoredDynamicBones; if (pair.Value._dirtyColliders.TryGetValue(pair.Key, out CollidersEditor.ColliderDataBase data) == false || data.ignoredDynamicBones.TryGetValue(this._parent, out ignoredDynamicBones) == false) { ignoredDynamicBones = null; } foreach (DynamicBone_Ver02 bone in this._dynamicBones) { if (ignoredDynamicBones != null && ignoredDynamicBones.Contains(bone)) // Should be ignored { if (bone.Colliders.Contains(normalCollider)) { bone.Colliders.Remove(normalCollider); } } else { if (bone.Colliders.Contains(normalCollider) == false) { bone.Colliders.Add(normalCollider); } } } } this._incIndex = -3; }
/// <summary> /// 貼り付け /// </summary> private void Paste() { DynamicBoneCollider toDynamicBoneCollider = (DynamicBoneCollider)target; toDynamicBoneCollider.m_Direction = dynamicBoneColliderCopy.m_Direction; toDynamicBoneCollider.m_Center = CopyVector3(dynamicBoneColliderCopy.m_Center); toDynamicBoneCollider.m_Bound = dynamicBoneColliderCopy.m_Bound; toDynamicBoneCollider.m_Radius = dynamicBoneColliderCopy.m_Radius; toDynamicBoneCollider.m_Height = dynamicBoneColliderCopy.m_Height; }
private static void AddColliderToDynamicBone(DynamicBone bone, DynamicBoneCollider dbc) { #if DEBUG IceLogger.Log($"Adding {bone.m_Root.name} to {dbc.gameObject.name}"); #endif if (!bone.m_Colliders.Contains(dbc)) { bone.m_Colliders.Add(dbc); } }
private static bool ColliderMeetsRules(DynamicBoneCollider coll, System.Tuple <GameObject, bool, DynamicBone[], DynamicBoneCollider[], bool> item) { bool valid = true; if (NDBConfig.onlyHandColliders) { valid &= coll.transform.IsChildOf(item.Item1.GetComponent <Animator>().GetBoneTransform(HumanBodyBones.LeftHand).parent) || coll.transform.IsChildOf(item.Item1.GetComponent <Animator>().GetBoneTransform(HumanBodyBones.RightHand).parent); } return(valid); }
string PrintCollider(DynamicBoneColliderBase collider) { //Let's see if this work DynamicBoneCollider coll = collider as DynamicBoneCollider; return("new DynamicBoneColliderData(" + PrintString(coll.transform.name) + ", " + "DynamicBoneCollider.Direction." + coll.m_Direction + ", " + PrintVector3(coll.m_Center) + ", " + "DynamicBoneCollider.Bound." + coll.m_Bound + ", " + PrintFloat(coll.m_Radius) + ", " + PrintFloat(coll.m_Height) + ")"); }
void CreateCollisionComponents(Transform t) { t.gameObject.AddComponent <DynamicBoneCollider>(); DynamicBoneCollider dbc = t.GetComponent <DynamicBoneCollider>(); dbc.m_Radius = 0.01f; colliders.Add(dbc); foreach (Transform child in t) { CreateCollisionComponents(child); } }
public DynamicBoneColliderMT(DynamicBoneCollider collider) { this.transform = new TransformMT(collider.transform); this.enabled = collider.enabled; this.m_Center = collider.m_Center; this.m_Radius = collider.m_Radius; this.m_Height = collider.m_Height; this.m_Direction = (Direction)collider.m_Direction; this.m_Bound = (Bound)collider.m_Bound; }
// Token: 0x0600271F RID: 10015 RVA: 0x000C0EA8 File Offset: 0x000BF2A8 public void Collide(ref Vector3 particlePosition, float particleRadius) { float num = this.m_Radius * Mathf.Abs(base.transform.lossyScale.x); float num2 = this.m_Height * 0.5f - this.m_Radius; if (num2 <= 0f) { if (this.m_Bound == DynamicBoneCollider.Bound.Outside) { DynamicBoneCollider.OutsideSphere(ref particlePosition, particleRadius, base.transform.TransformPoint(this.m_Center), num); } else { DynamicBoneCollider.InsideSphere(ref particlePosition, particleRadius, base.transform.TransformPoint(this.m_Center), num); } } else { Vector3 center = this.m_Center; Vector3 center2 = this.m_Center; DynamicBoneCollider.Direction direction = this.m_Direction; if (direction != DynamicBoneCollider.Direction.X) { if (direction != DynamicBoneCollider.Direction.Y) { if (direction == DynamicBoneCollider.Direction.Z) { center.z -= num2; center2.z += num2; } } else { center.y -= num2; center2.y += num2; } } else { center.x -= num2; center2.x += num2; } if (this.m_Bound == DynamicBoneCollider.Bound.Outside) { DynamicBoneCollider.OutsideCapsule(ref particlePosition, particleRadius, base.transform.TransformPoint(center), base.transform.TransformPoint(center2), num); } else { DynamicBoneCollider.InsideCapsule(ref particlePosition, particleRadius, base.transform.TransformPoint(center), base.transform.TransformPoint(center2), num); } } }
public void InitColliderTransform(DynamicBoneCollider collider) { if (transform == null) { transform = new TransformMT(collider.transform); } else { transform.InitTransform(collider.transform); } this.enabled = collider.enabled; }
internal static DynamicBoneCollider AddDBCollider(GameObject controllerGameObject, string colliderName, float colliderRadius = 0.05f, float collierHeight = 0f, Vector3 colliderCenter = new Vector3(), DynamicBoneCollider.Direction colliderDirection = default) { //Build the dynamic bone collider GameObject colliderObject = new GameObject(colliderName); DynamicBoneCollider collider = colliderObject.AddComponent <DynamicBoneCollider>(); collider.m_Radius = colliderRadius; collider.m_Height = collierHeight; collider.m_Center = colliderCenter; collider.m_Direction = colliderDirection; colliderObject.transform.SetParent(controllerGameObject.transform, false); return(collider); }
public void getCollider(DynamicBoneCollider collider, Animator an) { type = ColliderType.DynamicBoneCollider; bone.setTransform(collider.transform, an); m_Direction = collider.m_Direction; m_Center = collider.m_Center; m_Bound = collider.m_Bound; m_Radius = collider.m_Radius; m_Height = collider.m_Height; }
public static void RegisterCollider(DynamicBoneCollider collider, Predicate <IDynamicBoneWrapper> targetSelector = null) { if (targetSelector == null) { targetSelector = (bone) => true; } _Colliders[collider] = targetSelector; foreach (var bone in _Bones) { Correlate(bone, collider, targetSelector); } }
private static void AddColliderToBone(DynamicBone bone, DynamicBoneCollider collider) { if (NDBConfig.disallowInsideColliders && collider.m_Bound == DynamicBoneCollider.EnumNPublicSealedvaOuIn3vUnique.Inside) { return; } if (collider.m_Radius > NDBConfig.colliderSizeLimit || collider.m_Height > NDBConfig.colliderSizeLimit) { return; } AddColliderToDynamicBone(bone, collider); }
/// <summary> /// コライダーXMLデータ設定 /// </summary> /// <param name="xmlPath"></param> /// <param name="name"></param> /// <param name="target"></param> public override void SetXmlToCollider(string xmlPath, string name, DynamicBoneCollider target) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(xmlPath); foreach (XmlNode nodeData in xmlDoc.SelectNodes("DynamicBones/Collider")) { if (name == nodeData.SelectSingleNode("Name").InnerText) { ConvertColliderParamCopy(target, nodeData.SelectSingleNode("Params/Param/Collider")); return; } } }
private static void Correlate(IDynamicBoneWrapper bone, DynamicBoneCollider collider, Predicate <IDynamicBoneWrapper> targetSelector) { if (targetSelector(bone)) { if (!bone.Colliders.Contains(collider)) { bone.Colliders.Add(collider); } } else { bone.Colliders.Remove(collider); } }
// Token: 0x06000017 RID: 23 RVA: 0x000034B4 File Offset: 0x000016B4 public void Collide(ref Vector3 particlePosition, float particleRadius) { float num = this.m_Radius * Mathf.Abs(base.transform.lossyScale.x); float num2 = this.m_Height * 0.5f - this.m_Radius; bool flag = num2 <= 0f; if (flag) { bool flag2 = this.m_Bound == DynamicBoneCollider.Bound.Outside; if (flag2) { DynamicBoneCollider.OutsideSphere(ref particlePosition, particleRadius, base.transform.TransformPoint(this.m_Center), num); } else { DynamicBoneCollider.InsideSphere(ref particlePosition, particleRadius, base.transform.TransformPoint(this.m_Center), num); } } else { Vector3 center = this.m_Center; Vector3 center2 = this.m_Center; switch (this.m_Direction) { case DynamicBoneCollider.Direction.X: center.x -= num2; center2.x += num2; break; case DynamicBoneCollider.Direction.Y: center.y -= num2; center2.y += num2; break; case DynamicBoneCollider.Direction.Z: center.z -= num2; center2.z += num2; break; } bool flag3 = this.m_Bound == DynamicBoneCollider.Bound.Outside; if (flag3) { DynamicBoneCollider.OutsideCapsule(ref particlePosition, particleRadius, base.transform.TransformPoint(center), base.transform.TransformPoint(center2), num); } else { DynamicBoneCollider.InsideCapsule(ref particlePosition, particleRadius, base.transform.TransformPoint(center), base.transform.TransformPoint(center2), num); } } }
public static void checkAdd(HumanBodyBones bone, Animator an, Vector3 position, float size) { Transform child = an.GetBoneTransform(bone); DynamicBoneCollider collider = child.gameObject.GetComponent <DynamicBoneCollider>(); if (!collider) { DynamicBoneCollider dynbonec = child.gameObject.AddComponent(typeof(DynamicBoneCollider)) as DynamicBoneCollider; } else { collider.m_Radius = size; collider.m_Center = new Vector3(position.x, position.y, position.z); } }
void ApplyDynamicBoneCollider() { //gizmo以外は設定を反映する for (int j = 0; j < colliderObjects.Length; j++) { VRMSpringBoneColliderSetting settingData = (VRMSpringBoneColliderSetting)colliderObjects[j]; GameObject targetObject = GameObject.Find(settingData.TargetName); for (int i = 0; i < settingData.Colliders.Length; i++) { DynamicBoneCollider collider = targetObject.AddComponent <DynamicBoneCollider>(); collider.m_Center = settingData.Colliders[i].Offset; collider.m_Radius = settingData.Colliders[i].Radius; } } }
internal static DynamicBoneCollider GetControllerCollider <T>(string controllerDBName) where T : Controller { //Get active vr controller T controllerObj = GameObject.FindObjectOfType <T>(); if (controllerObj == null) { return(null); } //Create or fetch DynamicBoneColliders for the controller DynamicBoneCollider controllerCollider = controllerObj ? GetOrAttachCollider(controllerObj.gameObject, controllerDBName) : null; return(controllerCollider); }
private void SetDynamicBoneCollider() { bool head_set = false; bool chest_set = false; DynamicBoneCollider head_collider = new DynamicBoneCollider(); DynamicBoneCollider chest_collider = new DynamicBoneCollider(); foreach (LonghairSupporter.HairsGroup group in longhairSupporter.hairsGroup) { foreach (LonghairSupporter.HairsGroup.BoneSet hair in group.hairBones) { if (longhairSupporter.effectSetting[(int)hair.hairType].colliderTarget == LonghairSupporter.EffectSetting.ColliderTarget.Head) { if (!head_set) { head_set = true; // 頭部コライダー生成 GameObject DBC_head = (GameObject)PrefabUtility.InstantiatePrefab(longhairSupporter.headColliderPrefab); DBC_head.transform.parent = longhairSupporter.head; DBC_head.transform.localPosition = Vector3.zero; DBC_head.transform.rotation = Quaternion.identity; float scale = 1 / longhairSupporter.head.lossyScale.y; DBC_head.transform.localScale = new Vector3(scale, scale, scale); head_collider = DBC_head.transform.GetChild(0).GetComponent <DynamicBoneCollider>(); } hair.boneObject.GetComponent <DynamicBone>().m_Colliders.Add(head_collider); } if (longhairSupporter.effectSetting[(int)hair.hairType].colliderTarget == LonghairSupporter.EffectSetting.ColliderTarget.Chest) { if (!chest_set) { chest_set = true; // 胸部コライダー生成 GameObject DBC_chest = (GameObject)PrefabUtility.InstantiatePrefab(longhairSupporter.chestColliderPrefab); DBC_chest.transform.parent = longhairSupporter.chest; DBC_chest.transform.localPosition = Vector3.zero; DBC_chest.transform.rotation = Quaternion.identity; float scale = 1 / longhairSupporter.chest.lossyScale.y; DBC_chest.transform.localScale = new Vector3(scale, scale, scale); chest_collider = DBC_chest.transform.GetChild(0).GetComponent <DynamicBoneCollider>(); } hair.boneObject.GetComponent <DynamicBone>().m_Colliders.Add(chest_collider); } } } }
public static SerializableDynamicBoneCollider FromDynamicBoneCollider(DynamicBoneCollider collider) { Debug.Log($"Convert DynamicBoneCollider to serializable: {collider.name}"); var serializableCollider = new SerializableDynamicBoneCollider(); serializableCollider.TransformScale = collider.transform.lossyScale; serializableCollider.AttachedTo = HierarchyPath.FromTransform(collider.transform); // Copy values serializableCollider.m_Direction = collider.m_Direction; serializableCollider.m_Center = collider.m_Center; serializableCollider.m_Bound = collider.m_Bound; serializableCollider.m_Radius = collider.m_Radius; serializableCollider.m_Height = collider.m_Height; return(serializableCollider); }
internal void UpdateFingerColliders(float fingerRadius, float fingerLength) { if (!m_danPointsFound) { return; } Transform index = m_danCharacter.GetComponentsInChildren <Transform>().FirstOrDefault(x => x.name != null && x.name.Contains(BoneNames.IndexFinger)); Transform middle = m_danCharacter.GetComponentsInChildren <Transform>().FirstOrDefault(x => x.name != null && x.name.Contains(BoneNames.MiddleFinger)); Transform ring = m_danCharacter.GetComponentsInChildren <Transform>().FirstOrDefault(x => x.name != null && x.name.Contains(BoneNames.RingFinger)); m_indexCollider = InitializeCollider(index, fingerRadius, fingerLength); m_middleCollider = InitializeCollider(middle, fingerRadius, fingerLength); m_ringCollider = InitializeCollider(ring, fingerRadius, fingerLength); m_danOptions.fingerRadius = fingerRadius; m_danOptions.fingerLength = fingerLength; }
public void OnUpdate() { if (hasValues == null) ReadConfig(); if (realTime) ReadConfig(); if (toggle) { if (WereKeysPressed(useKeys)) isOn = !isOn; } else { isOn = false; if (WereKeysHeld(useKeys)) isOn = true; } if (useButt) { searchInt++; if (searchInt > 14) { searchInt = 0; CheckButtPhysics(); } } if (isOn) { if (!isTouching) { //create Ray rayy = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hitt; if (Physics.Raycast(rayy, out hitt, 20)) { human = hitt.collider.GetComponentInParent<Human>(); prevHuman = human; if (!human) return; if (human.sex != Human.SEX.FEMALE) return; } else { return; } if (useButt) { DestroyButt(human); CheckButtPhysics(); } Transform bust = human.transform.Find("DynamicBone/DynamicBone_Bust").transform; DynamicBone_Custom[] dbs = bust.GetComponentsInChildren<DynamicBone_Custom>(); isTouching = true; List<GameObject> tmpgos = new List<GameObject>(); List<string> dbgs = new List<string>(); for (int p = 0; p < 2; p++) { //node visualization for (int i = 0; i < 2; i++) { GameObject tmpSphere = GameObject.CreatePrimitive(PrimitiveType.Sphere); float rr = dbs[p].m_Radius * sphereScale; tmpSphere.transform.localScale = new Vector3(rr + sphereSize.x, rr + sphereSize.y, rr + sphereSize.z); tmpSphere.transform.rotation = dbs[p].m_Nodes.ToArray()[i].rotation; tmpSphere.transform.SetParent(dbs[p].m_Nodes.ToArray()[i]); tmpSphere.transform.position = dbs[p].m_Nodes.ToArray()[i].position; if (!boobDebug) { GameObject.Destroy(tmpSphere.GetComponent<MeshRenderer>()); GameObject.Destroy(tmpSphere.GetComponent<MeshFilter>()); } tmpSphere.GetComponent<Collider>().isTrigger = true; tmpgos.Add(tmpSphere); } } feelBall = GameObject.CreatePrimitive(PrimitiveType.Sphere); GameObject.Destroy(feelBall.GetComponent<Collider>()); if (!mouseDebug) { GameObject.Destroy(feelBall.GetComponent<MeshRenderer>()); GameObject.Destroy(feelBall.GetComponent<MeshFilter>()); } feelBallColl = feelBall.AddComponent<DynamicBoneCollider>(); feelBallColl.m_Radius = 0.5f; feelBallColl.m_Height = 0.0f; feelBall.transform.localScale = new Vector3(mouseScale, mouseScale, mouseScale); feelBall.transform.position = human.transform.position; for (int i = 0; i < dbs.Length; i++) { dbs[i].m_Colliders.Add(feelBallColl); } feelNodes = tmpgos.ToArray(); } else { //if we are touching if (feelBall) { Ray rayy = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hitt; if (Physics.Raycast(rayy, out hitt, 20)) { feelBallColl.enabled = true; human = hitt.collider.GetComponentInParent<Human>(); if (human != prevHuman) { DestroyCurrentFeel(); return; } timeOut = 0; float depth = mouseScale / 2f - mouseDepth; feelBall.transform.position = Vector3.Lerp(feelBall.transform.position, hitt.point + hitt.normal * depth, Time.deltaTime * 14f); } else { timeOut++; feelBallColl.enabled = false; if (timeOut > 175) { DestroyCurrentFeel(); return; } } /* if (WereKeysPressed(lfKeys)) { } if (WereKeysPressed(rfKeys)) { } */ } } } else { DestroyCurrentFeel(); } //End Update }