简体   繁体   English

unity c# 变换 Function

[英]Unity c# transform Function

I am new to unity I am learning to make a driving game and i am following a course from udemy, so far thigns seems to be nice but what they didnt explain is why unity takes Floating points for its transform functions such as transform.Rotate() transform.Translate().我是 unity 的新手,我正在学习制作驾驶游戏,并且正在学习 udemy 的课程,到目前为止,thigns 似乎不错,但他们没有解释的是为什么 unity 需要浮点数作为其变换函数,例如 transform.Rotate( ) 转换.翻译()。 and also how do we calculate our value for smooth motion and what data type it pretend if we do not use f with number for example (transform.Rotate(0,0,45))<- this function make the sprite rotate in z axis super fast while z=0.1f makes it smooth in in real life 0.1f is equal to what value for us humans to understand?以及我们如何计算平滑运动的值以及如果我们不将 f 与数字一起使用它假装什么数据类型,例如 (transform.Rotate(0,0,45))<- 这个 function 使精灵在 z 轴上旋转超快,而z=0.1f在现实生活中很流畅0.1f等于我们人类理解的什么值? and how it unity reads and understands it?以及它如何统一阅读和理解它?

Tried Values as Floating and without but couldnt understand difference also want to udnerstand how unity reads it and interpret Floating values尝试值作为浮动和没有但无法理解差异也想了解统一如何读取它并解释浮动值

In C# (and some of the other programming languages), the f suffix means float.在 C#(以及其他一些编程语言)中,f 后缀表示浮点数。
For example, float x = 0.1f means the value of x is 0.1 .例如, float x = 0.1f表示x的值为0.1
So, if you set the value of z in transform.Rotate to 0.1f , it rotates slower than z = 45 .因此,如果将transform.Rotate中的z值设置为0.1f ,它的旋转速度将比z = 45慢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM