johnv2pt0 Posted May 27, 2020 Posted May 27, 2020 Is a unit's current heading listed somewhere in the SSE? I'm trying to reference a stationary unit's heading.
Hardcard Posted May 27, 2020 Posted May 27, 2020 (edited) It can be calculated, provided you have access to the object's orientation subtable along the x axis. local My_Unit = Unit.getByName("name of the unit in ME") local Unit_Position = My_Unit:getPosition() Heading_radians = math.atan2( Unit_Position.x.z, Unit_Position.x.x ) if Heading_radians < 0 then Heading_radians = Heading_radians + 2 * math.pi end local Heading_degrees = Heading_radians * 180 / math.pi [color="Blue"]-- Unit's heading in degrees[/color] Alternatively, you can use the MOOSE method :GetHeading(), which runs the code I posted above, pretty much. Edited May 27, 2020 by Hardcard [sIGPIC][/sIGPIC]
johnv2pt0 Posted May 27, 2020 Author Posted May 27, 2020 Thanks Hardcard. You will never convert me into your Alces cult!
Hardcard Posted May 27, 2020 Posted May 27, 2020 Thanks Hardcard. You will never convert me into your Alces cult! Which is why I provided the standard DCS code ;) [sIGPIC][/sIGPIC]
Recommended Posts