[英]Beyond 180 degrees rotation
I want my object's rotation to go beyond 180 degrees when I add rotations to it.当我向它添加旋转时,我希望我的对象旋转到 go 超过 180 度。 Currently it goes into negative after it reaches 180. How do I avoid this from happening?
目前它在达到 180 后变为负数。如何避免这种情况发生?
// Update is called once per frame
void Update()
{
if(Input.GetKeyDown(KeyCode.R)){
this.transform.localEulerAngles = new Vector3(0, this.transform.localEulerAngles.y+ 70f, 0);
}
}
Rotations are always within 0-360.旋转始终在 0-360 之间。 As mentioned by Declan, you could convert them to be legible using this formula.
正如 Declan 所提到的,您可以使用此公式将它们转换为清晰易读。 Mathf.Abs(angle % 360)
Mathf.Abs(角度 % 360)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.