找回密码
 点一下
查看: 1509|回复: 5

关于新建单位到指定位标

[复制链接]
发表于 2008-9-4 16:14:31 | 显示全部楼层 |阅读模式
新建单位X给触发单位的有者,在(X.Y),面向Z角度

Z角度=XY坐标到触发单位的位置


在不设置点的情况下怎得出Z角度??
发表于 2008-9-4 16:41:14 | 显示全部楼层
你直接让单位面向单位不就行了~~还管什么点哪~~
回复

使用道具 举报

 楼主| 发表于 2008-9-4 16:52:07 | 显示全部楼层
我想一条T解决问题
回复

使用道具 举报

发表于 2008-9-4 17:29:54 | 显示全部楼层
那你就开动你的数学头脑自己算咯~~用获得单位X坐标和获得单位Y坐标的话是不会产生点的~~

不过你把那么复杂的算式写进一条触发里毫无意义~~因为跟分开的执行效率没差的~~
回复

使用道具 举报

发表于 2008-9-4 19:44:16 | 显示全部楼层
你可以去看看两点间角度的代码,恩恩
回复

使用道具 举报

发表于 2008-9-7 09:25:18 | 显示全部楼层
[codes=jass]
//返回距离   角度   
//GetUnitDistance(单位,单位)返回距离
//GetUnitPointDistance(单位,点,是否删除点     布尔值)返回距离
//GetPointDistance(点,点,是否删除点     布尔值)返回距离
//GetUnitAngle(单位,单位)返回角度
//GetUnitPointAngle(单位,点,是否删除点     布尔值)返回角度
//GetPointAngle(点,点,是否删除点     布尔值)返回角度
function GetUnitDistance takes unit a,unit b returns real
           local real dx = GetUnitX(a) - GetUnitX(b)
           local real dy = GetUnitY(a) - GetUnitY(b)
           return SquareRoot(dx * dx + dy * dy)
endfunction
function GetUnitPointDistance takes unit a,location b,boolean c returns real
           local real dx = GetUnitX(a) - GetLocationX(b)
           local real dy = GetUnitY(a) - GetLocationY(b)
           if c==true then
                 call RemoveLocation(b)
                 endif
           return SquareRoot(dx * dx + dy * dy)
endfunction
function GetPointDistance takes location a,location b,boolean c returns real
           local real dx = GetLocationX(a) - GetLocationX(b)
           local real dy = GetLocationY(a) - GetLocationY(b)
           if c==true then
                 call RemoveLocation(a)
                 call RemoveLocation(b)
                 endif
           return SquareRoot(dx * dx + dy * dy)
endfunction
function GetUnitAngle takes unit a,unit b returns real
           local real dx = GetUnitX(a) - GetUnitX(b)
           local real dy = GetUnitY(a) - GetUnitY(b)
           return Atan(dy/dx)
endfunction
function GetUnitPointAngle takes unit a,location b,boolean c returns real
           local real dx = GetUnitX(a) - GetLocationX(b)
           local real dy = GetUnitY(a) - GetLocationY(b)
           if c==true then
                 call RemoveLocation(b)
                 endif
           return Atan(dy/dx)
endfunction
function GetPointAngle takes location a,location b,boolean c returns real
           local real dx = GetLocationX(a) - GetLocationX(b)
           local real dy = GetLocationY(a) - GetLocationY(b)
           if c==true then
                 call RemoveLocation(a)
                 call RemoveLocation(b)
                 endif
           return Atan(dy/dx)
endfunction
[\\codes]
你就用call GetUnitAngle(新建的单位,触发单位)吧
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-7-21 06:29 , Processed in 0.033987 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表