本文整理匯總了Python中utils.Vec.to_angle方法的典型用法代碼示例。如果您正苦於以下問題:Python Vec.to_angle方法的具體用法?Python Vec.to_angle怎麽用?Python Vec.to_angle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類utils.Vec
的用法示例。
在下文中一共展示了Vec.to_angle方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: make_straight
# 需要導入模塊: from utils import Vec [as 別名]
# 或者: from utils.Vec import to_angle [as 別名]
def make_straight(
origin: Vec,
normal: Vec,
dist: int,
config: dict,
is_start=False,
):
"""Make a straight line of instances from one point to another."""
# 32 added to the other directions, plus extended dist in the direction
# of the normal - 1
p1 = origin + (normal * ((dist // 128 * 128) - 96))
# The starting brush needs to
# stick out a bit further, to cover the
# point_push entity.
p2 = origin - (normal * (96 if is_start else 32))
# bbox before +- 32 to ensure the above doesn't wipe it out
p1, p2 = Vec.bbox(p1, p2)
solid = vbsp.VMF.make_prism(
# Expand to 64x64 in the other two directions
p1 - 32, p2 + 32,
mat='tools/toolstrigger',
).solid
motion_trigger(solid.copy())
push_trigger(origin, normal, [solid])
angles = normal.to_angle()
support_file = config['support']
straight_file = config['straight']
support_positions = (
SUPPORT_POS[normal.as_tuple()]
if support_file else
[]
)
for off in range(0, int(dist), 128):
position = origin + off * normal
vbsp.VMF.create_ent(
classname='func_instance',
origin=position,
angles=angles,
file=straight_file,
)
for supp_ang, supp_off in support_positions:
if (position + supp_off).as_tuple() in SOLIDS:
vbsp.VMF.create_ent(
classname='func_instance',
origin=position,
angles=supp_ang,
file=support_file,
)