当前位置:网站首页>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;
}
}
}
边栏推荐
- In kuborad graphical interface, operate kubernetes cluster to realize master-slave replication in MySQL
- L2-011 play with binary tree
- Equal principal increasing repayment / equal principal decreasing mortgage repayment calculator
- 【网络空间安全数学基础第3章】同余
- [rust] rust language foundation | you should quickly get an impression when learning a language
- Time processing of basic library in go
- try...finally总结
- Convergence rules for 4 * 4 image weights
- Difference between GCC -l parameter and -l parameter
- Buckle practice - 24 remove repeated letters
猜你喜欢

在kuborad图形化界面中,操作Kubernetes 集群,实现mysql中的主从复制

如何最快找出复杂代码运行时的函数调用流程

Conference publishing function of conference OA project

Three small knowledge points about data product managers

JMeter while controller

QT | summary of the use of edit box

How to upload pictures from typora to CSDN

Qt5.12 + vs2019 cannot locate the program input point in the dynamic link library

Ansible的安装及部署

【网络空间安全数学基础第9章】有限域
随机推荐
Browser logic vulnerability collection
Buckle practice - sum of 34 combinations
Guys, do you need to configure anything to use rocksdb when using flinksql? Or do you need any jar packages
Source code analysis sentry user behavior record implementation process
[mathematical basis of Cyberspace Security Chapter 3] congruence
What is prescaler in STM32
One of his birds sold for 60million -- the collection of eight mountain people in the Ming and Qing Dynasties
在kuborad图形化界面中,操作Kubernetes 集群,实现mysql中的主从复制
Ansible的安装及部署
QT notes - realize form adaptation
Detailed explanation of MSTP protocol for layer 3 switch configuration [Huawei ENSP experiment]
如何将Typora中图片上传到csdn
Quick check list of various XSS payloads
MySQL advanced (XVII) cannot connect to database server problem analysis
L1-043 reading room
gcc -l参数和-L参数的区别
第0章 前言和环境配置
GCC的基本用法
C进阶——数据的存储
Wechat official account development: Material Management (temporary and permanent)