当前位置:网站首页>unity中物体z旋转同步面板上的数值
unity中物体z旋转同步面板上的数值
2022-07-24 09:51:00 【沧行】
unity中物体z旋转同步面板上的数值
//获取当前的角度
Vector3 angle = transform.eulerAngles;
//旋转
angle.z += rbody.velocity.y;
//将z旋转同步面板上的数值
angle.z = angle.z - 180;
if (angle.z > 0)
{
angle.z -= 180;
}
else
{
angle.z += 180;
}
限制物体z旋转的角度
angle.z = Mathf.Clamp(angle.z,-MaxAngle,MaxAngle);
注:
函数
public static float Clamp (float value, float min, float max);
参数
| 参数 | 注释 |
|---|---|
| value | 浮点值,限制在最小值和最大值定义的范围内。 |
| min | 要比较的最小浮点值。 |
| max | 要比较的最大浮点值。 |
返回
| 参数 | 注释 |
|---|---|
| float | 最小值到最大值之间的浮点值结果。 |
描述
在给定的最小浮点值和最大浮点值之间钳制给定值。如果在最小和最大范围内,则返回给定值。
如果给定的浮点值小于最小值,则返回最小值。如果给定值大于最大值,则返回最大值。使用 Clamp 可将某个值限制为最小值和最大值定义的某个范围内。
边栏推荐
- Recursion - if the function calls itself internally, then the function is a recursive function & the effect is the same as that of the loop & the push condition return should be added, otherwise stack
- RxJS Beginner Guide
- Learn more about the synchronized lock upgrade process [concurrent programming]
- Linux deployment mysql8.0
- [STM32 learning] (22) STM32 realizes 360 degree rotary encoder
- [200 opencv routines] 236. Principal component analysis of feature extraction (openCV)
- MySQL Basics (I) -- SQL Basics
- Is CITIC Securities a safe and reliable securities firm? How to open an account?
- Jenkins post build script does not execute
- C#/VB. Net: convert word or EXCEL documents to text
猜你喜欢

Opencv learning Day5

The heads of the five major international institutions called for urgent action to deal with the global food security crisis

Understanding of magnetic parameters in Hall sensors
![[don't bother to strengthen learning] video notes (II) 1. What is Q-learning?](/img/4f/809adc96e30fad03a113acc3df4b61.png)
[don't bother to strengthen learning] video notes (II) 1. What is Q-learning?

The most complete solution for distributed transactions

Spark Learning: compile spark source code in win10
![[C language] implementation of three versions of address book small project (including source code)](/img/3b/926001332ec05378de4c35dc28ed55.png)
[C language] implementation of three versions of address book small project (including source code)

ASI-20220222-Implicit PendingIntent
![Cyclicbarrier and countdownlatch [concurrent programming]](/img/38/3305a0cdb6de40e1370cc93c8e5014.png)
Cyclicbarrier and countdownlatch [concurrent programming]

MySQL Basics (I) -- SQL Basics
随机推荐
Makefile variables and dynamic library static library
[STM32 learning] (22) STM32 realizes 360 degree rotary encoder
Calculate CPU utilization [Prometheus]
A null pointer exception is reported when the wrapper class inserts into the empty field of the database table
PHP caching system - PHP uses Memcache
How does SRE and development of Google cooperate
Friends come to interview a unicorn company in Beijing at leisure. The interview question is priced at 25K
Source insight 3.5 comment garbled
Installation UMI tutorial (error reporting and solutions)
Development history of the first commercial humanoid biped robot in China
Write a simple memo using localstorage
Where is the bitbucket clone address
[robot learning] mechanism kinematics analysis and MATLAB simulation (3D model +word report +matlab program)
JS locate Daquan to get the brother, parent and child elements of the node, including robot instances
Learn more about the synchronized lock upgrade process [concurrent programming]
PHP log base - monolog knowledge collation
Raspberry Pie: the serial port has been unable to read the information sent by the upper computer
Scala learning: why emphasize immutable objects?
Boundless dialogue | participate in the live broadcast on July 25 and win the prize
JS, the return statement used in the for loop should be placed in the function to terminate the loop, similar to the invalid return problem in break & foreach