private void Update() { currentDist = Vector3.Magnitude(this.transform.position - follower.transform.position); ////gameObject.transform.localScale = (1 + (currentDist / createDist)) * initScale; //if (gameObject.transform.localPosition == initLocalPos) //{ // firstSpawn = true; // //thisInteract.enabled = true; //} { if (!thisInteract.isGrasped && currentPos != initPos) { returnToInit(null); } if (currentDist > createDist && follower.spawnable()) { spawnItem(gameObject.transform); //firstSpawn = false; } } }
private void Update() { currentPos = gameObject.transform.localPosition; currentDist = Vector3.Distance(initLocalPos, currentPos); gameObject.transform.localScale = (1 + (currentDist / createDist)) * initScale; if (gameObject.transform.localPosition == initLocalPos) { firstSpawn = true; //thisInteract.enabled = true; } { if (!thisInteract.isGrasped && currentPos != initPos) { returnToInit(null); } if ((Mathf.Abs(currentDist - createDist)) <= tolerance && firstSpawn && Parent.spawnable()) { GameObject loc = new GameObject(); loc.transform.position = menuSpawnPosition; loc.transform.rotation = Quaternion.AngleAxis(90, Vector3.down); spawnPanel(loc.transform); firstSpawn = false; } } }