当前位置:网站首页>Unity rotation test
Unity rotation test
2022-07-24 12:22:00 【Phyllostachys pubescens】
public class UnityApITest_1 : MonoBehaviour {
// Quaternions are multiplied by vectors
public GameObject go;
public GameObject resGo;
public Vector3 euler;
private void Update()
{
Debug.DrawLine(Vector3.zero, go.transform.position);
Debug.DrawLine(Vector3.zero, resGo.transform.position);
// Set the rotation
if (Input.GetKeyDown(KeyCode.A))
{
// Get the value of Quaternion
Quaternion qua = Quaternion.Euler(euler);
// Four yuan number * Get the new position of the vector
Vector3 res = qua * go.transform.position;
Debug.Log(" The result of quaternion multiplying vector is " + res);
resGo.transform.position = res;
// The change of one's own angle
resGo.transform.rotation = qua * go.transform.rotation;
}
// Look at the target object
if (Input.GetKeyDown(KeyCode.B))
{
// Suppose the target object is the origin
Vector3 dir = Vector3.zero - go.transform.position;
go.transform.forward = dir.normalized;
}
}
}
边栏推荐
- 三、MFC消息映射机制实现原理
- 动态内存管理
- [rust] what software should I use to develop rust? Recommended editors commonly used to support rust
- [data mining engineer - written examination] sheen company in 2022
- L1-043 reading room
- makefile快速使用
- 02 linear structure 2 multiplication and addition of univariate polynomials (linked list solution)
- js图像转base64
- gcc -l参数和-L参数的区别
- Buckle practice - 30 set the intersection size to at least 2
猜你喜欢

thinkphp 实现数据库备份

OpenCV:08图像金字塔

Convergence rules for 4 * 4 image weights

Installation and deployment of ansible
![[C and pointer Chapter 14] preprocessor](/img/da/a9a15299157389f8738f7c642a9ff7.png)
[C and pointer Chapter 14] preprocessor

C进阶——数据的存储

如何将Typora中图片上传到csdn

How to use a third party without obtaining root permission topic: MIUI chapter

L1-059 ring stupid bell

Online XML to CSV tool
随机推荐
Basic usage of GCC
Difference between GCC -l parameter and -l parameter
[rust] rust language foundation | you should quickly get an impression when learning a language
Wechat official account development: Material Management (temporary and permanent)
[C and pointer Chapter 11] dynamic memory allocation
一文看懂MES系统能实现企业哪些目标
Day4: circular structure
Buckle practice - 30 set the intersection size to at least 2
Why is there discontinuity in MySQL auto increment primary key?
【C和指针第11章】动态内存分配
三层交换机配置MSTP协议详解【华为eNSP实验】
Three small knowledge points about data product managers
Acwing 92. recursive implementation of exponential enumeration
如何最快找出复杂代码运行时的函数调用流程
Wechat applet learning five page Jump methods
[C and pointer Chapter 14] preprocessor
L1-064 估值一亿的AI核心代码
理解数据的存与取
Buckle practice - maximum number of 28 splices
Day5: construct program logic