/* * first, we need to get the new center of tracking space, relative to current location of player and the npc he is travelling to * Then, move the tracking space such that the player is still in the same position relative to tracking space. * */ public void ShiftTeleportToNewPos(Vector3 pos) { Vector3 dir = newCenter - this.transform.position; //dir.y = 0f; if (dir.magnitude > shiftStopDist) { // still moving to our destination this.transform.Translate(dir * shiftSpeed * Time.deltaTime, Space.World); } else { // we have reached our destination shifting = false; transition.EndFX(); RecenterTrackingSpace(currentNPC.transform.position); // Either turn cam to face old npc // OR turn cam to face current NPC pov TurnCamToFaceDir(oldCenter - pos); //TurnCamToFaceDir (currentNPC.transform.forward); parentNPCToCam(currentNPC); finishedShifting = true; reachedPlanet = true; } }