Squiggs Posted June 5, 2024 Posted June 5, 2024 I know that the getPosition function returns an array denoting the unit's position and orientation, but I am struggling with how to use this information to get another unit to go there.
TEMPEST.114 Posted June 5, 2024 Posted June 5, 2024 (edited) https://wiki.hoggitworld.com/view/DCS_Scripting_orig_Part_1 https://wiki.hoggitworld.com/view/DCS_func_getPosition https://wiki.hoggitworld.com/view/DCS_func_setTask You have to create a task with a waypoint of the new position. Edited June 5, 2024 by TEMPEST.114
Grimes Posted June 5, 2024 Posted June 5, 2024 getPoint might be more directly useful as it only returns the coordinates. However getPosition().p is functionally the same thing. The rest of the values returned with position are used only with the orientation of the object. For example: local heading = math.atan2(unitpos.x.z, unitpos.x.x) Worth noting that the coordinates used in tasks is typically a "vec2" and not "vec3". Which basically means that the vec3.z value needs to be the vec2.y value. So... local point = Unit.getByName("target"):getPoint() local task = {} task.x = point.x task.y = point.z https://wiki.hoggitworld.com/view/DCS_task_mission The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
Recommended Posts