当前位置:网站首页>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;
}
}
}
边栏推荐
- Buckle practice - 27 score after turning the matrix
- Leecode-268. missing numbers (Application of XOR, find numbers that do not appear, find numbers that only appear once)
- 如何最快找出复杂代码运行时的函数调用流程
- Optimization method of "great mathematics for use" -- optimal design of Cascade Reservoir Irrigation
- Qt5.12 + vs2019 cannot locate the program input point in the dynamic link library
- MySQL advanced (XVII) cannot connect to database server problem analysis
- Time processing of basic library in go
- Detailed explanation of MSTP protocol for layer 3 switch configuration [Huawei ENSP experiment]
- Installation and deployment of ansible
- Day3: branch structure
猜你喜欢

C Advanced - data storage

The art of management - driving software R & D efficiency through leadership

Pushgateway installation and Prometheus configuration

Use and expansion of fault tolerance and fusing

Day3: branch structure

Zhihuihuayun | cluster log dynamic collection scheme

OpenCV:08图像金字塔

Design of digital oscilloscope based on arm and FPGA -- QMJ

【C和指针第14章】预处理器
![[mathematical basis of Cyberspace Security Chapter 9] finite field](/img/2b/27ba1f3c6ec2ecff4538f9a63a79e8.jpg)
[mathematical basis of Cyberspace Security Chapter 9] finite field
随机推荐
Miss waiting for a year! Baidu super chain digital publishing service is limited to 50% discount
Installation and deployment of ansible
Day3: branch structure
makefile快速使用
How to realize the function of grabbing red envelopes in IM system?
How to use a third party without obtaining root permission topic: MIUI chapter
Microsoft SQL Server database language and function usage (XII)
Buckle practice - 25 non overlapping intervals
Basic usage of GCC
[I also want to brush through leetcode] 468. Verify the IP address
How to upload pictures from typora to CSDN
Buckle practice - 27 score after turning the matrix
Try... Finally summary
Day4: circular structure
Summary of MySQL database combined with actual SQL optimization of the project
Agile? DevOps ?
如何在IM系统中实现抢红包功能?
Markdown mathematical formula syntax
6-16漏洞利用-rlogin最高权限登陆
QT notes - qtablewidget table spanning tree, qtreewidget tree node generates table content