Wyverex Posted March 29, 2023 Posted March 29, 2023 (edited) Hi, I'm currently exporting data from both `LoGetCameraPosition` and `LoGetSelfData` to calculate the camera position within the cockpit. local selfData = LoGetSelfData() if selfData ~= nil then local cameraPos = LoGetCameraPosition() if cameraPos ~= nil and cameraPos.p ~= nil then local toSend = { pos = selfData.Position, h = selfData.Heading, p = selfData.Pitch, b = selfData.Bank, c = cameraPos, t = socket.gettime() } Ivy.sendCommand("cam", toSend) end end On the receiving end, I calculate a quaternion from the rotation data and transform the camera position relative to the aircraft position. This generally works totally fine and I get correct results as long as the aircraft is standing still. However, in flight, my results vary by up to 0.6m when flying at 160 km/h for example. These two exports show such a difference along the X axis (which points forward in DCS). [2023-03-29 19:53:39.313] [IvyVR] [info] cam_ac (3.015137387800653, 0.3236163383971928, -0.0058042729454039765) [2023-03-29 19:54:12.014] [IvyVR] [info] cam_ac (2.416017720146929, 0.23703545435031226, -0.02618762237694683) (Note that my relative camera position didn't change except for minute movements of my head which is reflected in the slight differences along the other axes) A likely explanation would be that the results of selfData and cameraPos are from two different points in time between which the aircraft has already moved a bit further, which is why there's a gap in between them. I export both within the same tick though, so my assumption was that the data should be internally consistent. Does an export script run on a different thread which means that there's a sufficient time gap between LoGetSelfData and LoGetCameraPosition to give results from different game ticks? Is there a way I can get consistent results? Edited March 29, 2023 by Wyverex
futurecpit Posted September 6, 2023 Posted September 6, 2023 I'm having a similar problem. Did you ever find a solution?
Shaftoe62 Posted February 18, 2024 Posted February 18, 2024 I also have a question about LoGetCameraPosition. How can I get the camera rotation from left to right? Does one of you know the answer to that?
Recommended Posts