winghunter Posted February 15, 2022 Share Posted February 15, 2022 (edited) Im using mist.cloneGroup to spawn new units and mist.teleportTopPoint to position them. But how can I change their heading / rotation ? this doesnt work local unit = mist.getGroupData(grp).units[1] local newHeading = Heading + math.pi unit.heading = newHeading Thanks Edited February 15, 2022 by winghunter DCS Web Editor - New 3D Mission Editor for DCS that runs in your browser DCS Web Viewer free browser based mission planner / viewer 4090 RTX, 13700KF, water cooled Link to comment Share on other sites More sharing options...
Wizxrd Posted February 15, 2022 Share Posted February 15, 2022 local newHeading = heading*math.pi/180 That should do the trick! Link to comment Share on other sites More sharing options...
winghunter Posted February 15, 2022 Author Share Posted February 15, 2022 12 minutes ago, Wizxrd said: local newHeading = heading*math.pi/180 That should do the trick! Thanks though i forgot to mention Heading is already in radians, as i get it form local Heading = mist.getHeading(player) DCS Web Editor - New 3D Mission Editor for DCS that runs in your browser DCS Web Viewer free browser based mission planner / viewer 4090 RTX, 13700KF, water cooled Link to comment Share on other sites More sharing options...
toutenglisse Posted February 15, 2022 Share Posted February 15, 2022 (edited) 5 hours ago, winghunter said: Im using mist.cloneGroup to spawn new units and mist.teleportTopPoint to position them. But how can I change their heading / rotation ?... If you clone a group, only the datas of original group will be used. No way to change them. If you want to change them, you need to spawn a new group with mist.dynAdd(), instead of cloning. (change groupName if you don't want to destroy previous group at spawn) Code example to randomize headings at spawn of units of a ground group named 'test' : local GPdata = mist.getGroupData('test') for i = 1, #GPdata.units do GPdata.units[i].heading = mist.utils.toRadian(mist.random(360)) end mist.dynAdd(GPdata) Edited February 15, 2022 by toutenglisse Link to comment Share on other sites More sharing options...
winghunter Posted February 16, 2022 Author Share Posted February 16, 2022 10 hours ago, toutenglisse said: If you clone a group, only the datas of original group will be used. No way to change them. If you want to change them, you need to spawn a new group with mist.dynAdd(), instead of cloning. (change groupName if you don't want to destroy previous group at spawn) Code example to randomize headings at spawn of units of a ground group named 'test' : local GPdata = mist.getGroupData('test') for i = 1, #GPdata.units do GPdata.units[i].heading = mist.utils.toRadian(mist.random(360)) end mist.dynAdd(GPdata) Thanks, i've updated to latest mist and tried this approach. It seems however that heading makes no difference to spawning air units, they will always face north even though their heading data says different. DCS Web Editor - New 3D Mission Editor for DCS that runs in your browser DCS Web Viewer free browser based mission planner / viewer 4090 RTX, 13700KF, water cooled Link to comment Share on other sites More sharing options...
toutenglisse Posted February 16, 2022 Share Posted February 16, 2022 1 hour ago, winghunter said: Thanks, i've updated to latest mist and tried this approach. It seems however that heading makes no difference to spawning air units, they will always face north even though their heading data says different. heading is only for ground unit. Air spawned aircraft heading is defined by next wpt direction (same as in mission editor). Link to comment Share on other sites More sharing options...
winghunter Posted February 16, 2022 Author Share Posted February 16, 2022 Ohhh thanks, this DCS api is full of easter eggs DCS Web Editor - New 3D Mission Editor for DCS that runs in your browser DCS Web Viewer free browser based mission planner / viewer 4090 RTX, 13700KF, water cooled Link to comment Share on other sites More sharing options...
Recommended Posts