public void CustomUpdate() { if (!contactPointSet) { var contactPoint = memoryBridge.GetVector3(wristServo.servoName + "contactPoint"); if (contactPoint != Vector3.zero) { Debug.Log("Set ground point to " + contactPoint); //wristServo.contactPoint = contactPoint; wristServo.CreateContactPoint(contactPoint); contactPointSet = true; } } //if (!FlightGlobals.ActiveVessel.packed) foreach (var servo in limbServos) { servo.CustomUpdate(); } if (contactPointSet) { wristServo.CheckFootClearance(); } // if(footPart) // if(footPart.torque) }
IEnumerator WriteCameraFeed() { writingCamFile = true; var tempLocalPos = feedCam.transform.localPosition; var bridgeCamPos = memoryBridge.GetVector3("CamLocalPos" + fileName + memoryBridge.cameraFeeds.Count); tempLocalPos.x = bridgeCamPos.x; tempLocalPos.y = -bridgeCamPos.z; tempLocalPos.z = bridgeCamPos.y; feedCam.transform.localPosition = tempLocalPos; feedCam.transform.localEulerAngles = memoryBridge.GetVector3("CamLocalEuler" + fileName + memoryBridge.cameraFeeds.Count); RenderTexture.active = rendText; tex.ReadPixels(new Rect(0, 0, rendTextWidth, rendTextHeight), 0, 0); //tex.Apply(); // camTexture = tex; var textureByte = tex.GetRawTextureData(); // //Debug.Log(textureByte.Length); var multiple = textureByte.Length / threadList.Count; Stream mapStream0 = camFeedFile.MapView(MapAccess.FileMapAllAccess, 0, multiple); Stream mapStream1 = camFeedFile.MapView(MapAccess.FileMapAllAccess, 0, multiple); Stream mapStream2 = camFeedFile.MapView(MapAccess.FileMapAllAccess, 0, multiple); Stream mapStream3 = camFeedFile.MapView(MapAccess.FileMapAllAccess, 0, multiple); ParallelProcessor.EachParallel(threadList, thread => { switch (thread) { case 0: mapStream0.Write(textureByte, 0, multiple); break; case 1: mapStream1.Write(textureByte, 0, multiple); break; case 2: mapStream2.Write(textureByte, 0, multiple); break; case 3: mapStream3.Write(textureByte, 0, multiple); break; } }); mapStream0.Flush(); mapStream1.Flush(); mapStream2.Flush(); mapStream3.Flush(); mapStream0.Close(); mapStream1.Close(); mapStream2.Close(); mapStream3.Close(); RenderTexture.active = null; writingCamFile = false; yield break; }