我不知道我在这段代码中做错了什么:
func findDegree() -> Double {
let xValue = directionstick.center.x - 35
let yValue = directionstick.center.y + 20
let newX = xValue*xValue
let newY = yValue*yValue
let hypo = (newX+newY).squareRoot()
return (xValue/hypo)
}
此代码用于查找旋转量。
答案 0 :(得分:0)
我知道了:
func findDegree() -> Double {
let xValue = directionstick.center.x - 35
let yValue = directionstick.center.y + 20
let angle = atan2(xValue, yValue)
Return angle
}