在我玩的游戏中,在戈多引擎中,我在一些地方给出了角度,在其他地方给出了弧度。有时我需要把这两个角度混合起来。加起来)。
什么内置功能允许我将学位转换成弧度(反过来)?还是一个都没有?
我意识到转换这些不是火箭科学,我可以自己编写一些代码,但戈多已经在内部进行这样的转换,所以我猜测这样的函数已经存在。
发布于 2017-09-16 11:59:43
这是可以实现的:
deg2rad()
和rad2deg
函数。deg_to_rad()
和rad_to_deg()
函数。每个函数都接受一个浮点(正在转换的值)并返回一个浮点数(转换后的值)。
发布于 2018-11-06 23:38:38
Godot3.0中的一些节点具有可以使用的属性rotation_degrees
,即
# rotate the node a quarter turn using radians
my_2D_node.rotation += PI / 2
# read the current rotation in degrees
my_2D_node.rotation_degrees
属性rotation_degrees可以读取和设置,例如,您可以在方便的地方将属性写为.rotation
,而在脚本中的其他地方,如果程度更方便,则可以将属性读入.rotation_degrees
。对象将为您执行转换。
https://gamedev.stackexchange.com/questions/148478
复制相似问题