void startDocking(ParagliderFinish finish) { if (finish == null) { Debug.LogError("WARNING: no docked target found, there must be a problem with the ParagliderFinish"); } togglePhysics(false); dockingTarget = finish.transform; dockingDistance = Vector3.Distance(finish.transform.position, finish.dockingPoint.position); //doesnt need to be that point because target is billboard dockingTime = dockingDuration; // find the next point between position and dockingTarget in dockingDistance from dockingTarget Vector3 vec3 = transform.position; //billboard is only around y so docking must be horrizontal vec3.y = dockingTarget.position.y; nextDockingPoint.position = Vector3.MoveTowards(dockingTarget.position, vec3, dockingDistance); // find rotation towards docking target nextDockingPoint.LookAt(dockingTarget.position); //prohibit rotation around viewing axis vec3 = nextDockingPoint.eulerAngles; vec3.z = 0; nextDockingPoint.eulerAngles = vec3; setThermic(0); onDocking(); isDocking = true; }
// Use this for initialization void Start() { //setup the projection of the camera to the target quad to get an exact projetion that can be reused by the level frame previewTexture = new RenderTexture(RendertextureScale.x, RendertextureScale.y, 0); if (previewFinishObject == null) { previewFinishObject = GetComponentInChildren <ParagliderFinish>(); } //now adjust the camera position previewFinishObject.transform.parent = projection.theCam.transform.parent; projection.theCam.transform.position = previewFinishObject.dockingPoint.position; previewFinishObject.transform.parent = projection.theCam.transform; //now do the setup of the projection projection.screenQuad = previewFinishObject.previewQuad.transform; projection.Setup(); projection.theCam.targetTexture = previewTexture; projection.theCam.enabled = false; isSetUp = true; }