💥 名称简化
This commit is contained in:
parent
1e0c2c9926
commit
68e456fe8f
|
@ -131,7 +131,7 @@ func (slf *Moving2D) handle() {
|
|||
slf.OnPosition2DDestinationEvent(entity)
|
||||
continue
|
||||
} else {
|
||||
nx, ny := geometry.CalculateNewCoordinate(x, y, angle, moveDistance)
|
||||
nx, ny := geometry.CalcNewCoordinate(x, y, angle, moveDistance)
|
||||
entity.SetPosition(nx, ny)
|
||||
entity.lastMoveTime = moveTime
|
||||
slf.OnPosition2DChangeEvent(entity, x, y)
|
||||
|
|
|
@ -126,8 +126,8 @@ func CalcAngle[V generic.SignedNumber](x1, y1, x2, y2 V) V {
|
|||
return V(math.Atan2(float64(y2-y1), float64(x2-x1)) * 180 / math.Pi)
|
||||
}
|
||||
|
||||
// CalculateNewCoordinate 根据给定的x、y坐标、角度和距离计算新的坐标
|
||||
func CalculateNewCoordinate[V generic.SignedNumber](x, y, angle, distance V) (newX, newY V) {
|
||||
// CalcNewCoordinate 根据给定的x、y坐标、角度和距离计算新的坐标
|
||||
func CalcNewCoordinate[V generic.SignedNumber](x, y, angle, distance V) (newX, newY V) {
|
||||
// 将角度转换为弧度
|
||||
var pi = math.Pi
|
||||
var dividend = 180.0
|
||||
|
|
Loading…
Reference in New Issue