|
发表于 2020-3-14 09:25:26
来自手机
|
显示全部楼层
IP:浙江
首先获得生物的朝向和坐标
rotation = self.CreateComponent( entityId, "Minecraft", "rot ).GetRot()
position = self.CreateComponent( entityId, "Minecraft", "pos" ).GetPos()
然后通过朝向获取生物朝向的方向向量
vector = serverApi.GetDirFromRot( rotation )
最后给定一个偏移距离,计算出新的发射起始点
alignLength = 1.0 # 偏移距离
x = position[0] + vector[0] * alignLength
y与z同理
最终使用计算好的 x y z 坐标生成抛射物即可 |
|