Jump to content

Recommended Posts

Posted

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.

Posted

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 ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...